diff options
Diffstat (limited to 'server/src/data.rs')
| -rw-r--r-- | server/src/data.rs | 19 | 
1 files changed, 13 insertions, 6 deletions
| diff --git a/server/src/data.rs b/server/src/data.rs index 6affccb5..9f03b1ea 100644 --- a/server/src/data.rs +++ b/server/src/data.rs @@ -31,14 +31,15 @@ pub struct InitialMap {      tiles: HashMap<String, String>,  } -#[derive(Debug, Clone, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize, Default)]  pub struct Gamedata {      pub recipes: Vec<Recipe>,      pub item_names: Vec<String>,      pub tile_names: Vec<String>,      #[serde(skip)]      pub initial_map: HashMap<IVec2, TileIndex>, -    pub spawn: Vec2, +    pub chef_spawn: Vec2, +    pub customer_spawn: Vec2,  }  pub fn build_gamedata(recipes_in: Vec<RecipeDecl>, map_in: InitialMap) -> Gamedata { @@ -77,14 +78,19 @@ pub fn build_gamedata(recipes_in: Vec<RecipeDecl>, map_in: InitialMap) -> Gameda          assert_eq!(outputs.next(), None, "{r2:?}");      } -    let mut spawn = Vec2::new(0., 0.); +    let mut chef_spawn = Vec2::new(0., 0.); +    let mut customer_spawn = Vec2::new(0., 0.);      let mut initial_map = HashMap::new();      for (y, line) in map_in.map.iter().enumerate() {          for (x, tile) in line.trim().char_indices() {              let pos = IVec2::new(x as i32, y as i32);              let mut tilename = map_in.tiles[&tile.to_string()].clone(); -            if tilename == "spawn" { -                spawn = pos.as_vec2(); +            if tilename == "chef-spawn" { +                chef_spawn = pos.as_vec2(); +                tilename = "floor".to_owned(); +            } +            if tilename == "customer-spawn" { +                customer_spawn = pos.as_vec2();                  tilename = "floor".to_owned();              }              let tile = register(&tile_names, tilename); @@ -97,7 +103,8 @@ pub fn build_gamedata(recipes_in: Vec<RecipeDecl>, map_in: InitialMap) -> Gameda          initial_map,          item_names: item_names.into_inner().unwrap(),          tile_names: tile_names.into_inner().unwrap(), -        spawn, +        chef_spawn, +        customer_spawn,      }  } | 
