Update to gamelog v0.5.0
This commit is contained in:
2
gamelog/Cargo.lock
generated
2
gamelog/Cargo.lock
generated
@@ -19,7 +19,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gamelog"
|
name = "gamelog"
|
||||||
version = "0.3.1"
|
version = "0.5.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ron",
|
"ron",
|
||||||
"semver",
|
"semver",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "gamelog"
|
name = "gamelog"
|
||||||
version = "0.3.1"
|
version = "0.5.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -10,13 +10,30 @@ pub enum Event {
|
|||||||
Kickoff(Offence),
|
Kickoff(Offence),
|
||||||
Turnover(Offence),
|
Turnover(Offence),
|
||||||
Penalty(TerrainState),
|
Penalty(TerrainState),
|
||||||
Score(u8),
|
Score(ScorePoints),
|
||||||
Pat(PatPoints),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Deserialize, Clone, PartialEq)]
|
||||||
pub enum PatPoints {
|
pub enum ScorePoints {
|
||||||
Fail,
|
Touchdown,
|
||||||
One,
|
FieldGoal,
|
||||||
Two,
|
Safety,
|
||||||
|
PatFail,
|
||||||
|
PatTouchdown,
|
||||||
|
PatFieldGoal,
|
||||||
|
PatSafety,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ScorePoints {
|
||||||
|
pub fn to_points(&self) -> u8 {
|
||||||
|
match &self {
|
||||||
|
Self::Touchdown => 6,
|
||||||
|
Self::FieldGoal => 3,
|
||||||
|
Self::Safety => 2,
|
||||||
|
Self::PatFail => 0,
|
||||||
|
Self::PatTouchdown => 2,
|
||||||
|
Self::PatFieldGoal => 1,
|
||||||
|
Self::PatSafety => 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ mod play;
|
|||||||
mod terrain;
|
mod terrain;
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub const MIN_VER: semver::Version = semver::Version::new(0, 4, 0);
|
pub const MIN_VER: semver::Version = semver::Version::new(0, 5, 0);
|
||||||
|
|
||||||
pub use action::*;
|
pub use action::*;
|
||||||
pub use event::Event;
|
pub use event::Event;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use crate::{Event, PlayHandle};
|
use crate::{Event, Play, PlayHandle};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
@@ -9,7 +9,7 @@ pub struct Period {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl PlayHandle for Period {
|
impl PlayHandle for Period {
|
||||||
fn plays(&self) -> Vec<crate::Play> {
|
fn plays(&self) -> Vec<Play> {
|
||||||
self.events
|
self.events
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|event| {
|
.filter_map(|event| {
|
||||||
|
|||||||
@@ -26,9 +26,13 @@ impl PlayHandle for Play {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Distance for Play {
|
impl Distance for Play {
|
||||||
fn distance(&self) -> u8 {}
|
fn distance(&self) -> u8 {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
fn delta<D: Distance>(&self, d: D) {}
|
fn delta<D: Distance>(&self, d: D) {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, Default, PartialEq)]
|
#[derive(Debug, Deserialize, Clone, Default, PartialEq)]
|
||||||
|
|||||||
Reference in New Issue
Block a user