diff --git a/Cargo.toml b/Cargo.toml index e500b49..8fe12fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "gbx-header" -version = "0.6.0" +version = "0.7.0" authors = ["Markus Becker "] edition = "2018" license = "Apache-2.0" diff --git a/src/gbx/mod.rs b/src/gbx/mod.rs index 4894821..f85c2ab 100644 --- a/src/gbx/mod.rs +++ b/src/gbx/mod.rs @@ -234,6 +234,8 @@ impl Default for MapType { pub enum GBXVersion { /// Unknown Type/Version Unknown, + /// Challenge v5 + TMc5, /// Challenge v6 TMc6, /// Replay v7 @@ -245,6 +247,7 @@ impl TryFrom<&str> for GBXVersion { fn try_from(value: &str) -> Result { match value.to_lowercase().as_str() { + "tmc.5" => Ok(GBXVersion::TMc5), "tmc.6" => Ok(GBXVersion::TMc6), "tmr.7" => Ok(GBXVersion::TMr7), _ => Err(format!("Unknown GBX file version: {}", value)), @@ -256,6 +259,7 @@ impl GBXVersion { /// Converts specific GBX file version and type (GBXVersion) into more generic GBXType. pub fn content_type(&self) -> GBXType { match self { + GBXVersion::TMc5 => GBXType::Challenge, GBXVersion::TMc6 => GBXType::Challenge, GBXVersion::TMr7 => GBXType::Replay, GBXVersion::Unknown => GBXType::Unknown, @@ -279,6 +283,12 @@ impl Default for GBXVersion { #[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] pub enum Environment { + Alpine, + Bay, + Coast, + Island, + Rally, + Speed, Stadium, } @@ -287,6 +297,12 @@ impl TryFrom<&str> for Environment { fn try_from(value: &str) -> Result { match value.to_lowercase().as_str() { + "alpine" => Ok(Environment::Alpine), + "bay" => Ok(Environment::Bay), + "coast" => Ok(Environment::Coast), + "island" => Ok(Environment::Island), + "rally" => Ok(Environment::Rally), + "speed" => Ok(Environment::Speed), "stadium" => Ok(Environment::Stadium), _ => Err(format!("Unknown environment: {}", value)), } @@ -311,11 +327,17 @@ impl TryFrom<&str> for Mood { type Error = String; fn try_from(value: &str) -> Result { - match value.to_lowercase().as_str() { + match value.trim().to_lowercase().as_str() { "day" => Ok(Mood::Day), "sunset" => Ok(Mood::Sunset), "sunrise" => Ok(Mood::Sunrise), "night" => Ok(Mood::Night), + "10x150sunrise" => Ok(Mood::Sunrise), + "20x60sunset" => Ok(Mood::Sunset), + "30x30" => Ok(Mood::Day), + "30x30sunrise" => Ok(Mood::Sunrise), + "30x30sunset" => Ok(Mood::Sunset), + "simple" => Ok(Mood::Day), _ => Err(format!("Unknown mood: {}", value)), } } @@ -329,7 +351,10 @@ impl Default for Mood { #[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] pub enum DescType { + Platform, + Puzzle, Race, + Stunts, } impl TryFrom<&str> for DescType { @@ -337,7 +362,10 @@ impl TryFrom<&str> for DescType { fn try_from(value: &str) -> Result { match value.to_lowercase().as_str() { + "platform" => Ok(DescType::Platform), + "puzzle" => Ok(DescType::Puzzle), "race" => Ok(DescType::Race), + "stunts" => Ok(DescType::Stunts), _ => Err(format!("Unknown desc.type: {}", value)), } }