From d720dabb780ba3c73a4656d8dc8fede721d6841d Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 20 Jul 2024 16:56:00 +0200 Subject: correctly send lobby bool and send map name --- server/src/data.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'server/src/data.rs') diff --git a/server/src/data.rs b/server/src/data.rs index 2d190f3b..7f5ed9a6 100644 --- a/server/src/data.rs +++ b/server/src/data.rs @@ -98,20 +98,21 @@ pub struct Demand { pub points: i64, } -#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[derive(Debug, Clone, Default)] #[rustfmt::skip] pub struct Gamedata { pub spec: String, + pub map_name: String, pub item_names: Vec, pub tile_names: Vec, pub tile_collide: Vec, pub tile_interact: Vec, pub map: HashMap, - #[serde(skip)] pub recipes: Vec, - #[serde(skip)] pub initial_map: HashMap)>, - #[serde(skip)] pub chef_spawn: Vec2, - #[serde(skip)] pub customer_spawn: Vec2, - #[serde(skip)] pub entities: Vec, + pub recipes: Vec, + pub initial_map: HashMap)>, + pub chef_spawn: Vec2, + pub customer_spawn: Vec2, + pub entities: Vec, } #[derive(Debug, Deserialize, Default)] @@ -164,14 +165,19 @@ impl DataIndex { let map_in = serde_yml::from_str(&self.read_map(map).await?)?; let recipes_in = serde_yml::from_str(&self.read_recipes(recipes).await?)?; - let mut gd = Gamedata::build(spec, map_in, recipes_in)?; + let mut gd = Gamedata::build(spec.clone(), map.to_string(), map_in, recipes_in)?; gd.map = self.maps.clone(); Ok(gd) } } impl Gamedata { - pub fn build(spec: String, map_in: InitialMap, recipes_in: Vec) -> Result { + pub fn build( + spec: String, + map_name: String, + map_in: InitialMap, + recipes_in: Vec, + ) -> Result { let reg = ItemTileRegistry::default(); let mut recipes = Vec::new(); let mut entities = Vec::new(); @@ -313,6 +319,7 @@ impl Gamedata { Ok(Gamedata { spec, tile_collide, + map_name, tile_interact, recipes, map: HashMap::new(), -- cgit v1.2.3-70-g09d2