diff options
Diffstat (limited to 'server/src/data.rs')
-rw-r--r-- | server/src/data.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/server/src/data.rs b/server/src/data.rs index d138f360..3526d786 100644 --- a/server/src/data.rs +++ b/server/src/data.rs @@ -40,12 +40,18 @@ pub struct Gamedata { pub initial_map: HashMap<IVec2, TileIndex>, pub chef_spawn: Vec2, pub customer_spawn: Vec2, + pub demands: Vec<usize>, } -pub fn build_gamedata(recipes_in: Vec<RecipeDecl>, map_in: InitialMap) -> Gamedata { +pub fn build_gamedata( + recipes_in: Vec<RecipeDecl>, + map_in: InitialMap, + demands_in: Vec<String>, +) -> Gamedata { let item_names = RwLock::new(Vec::new()); let tile_names = RwLock::new(Vec::new()); let mut recipes = Vec::new(); + let mut demands = Vec::new(); for r in recipes_in { let r2 = r.clone(); @@ -78,6 +84,10 @@ pub fn build_gamedata(recipes_in: Vec<RecipeDecl>, map_in: InitialMap) -> Gameda assert_eq!(outputs.next(), None, "{r2:?}"); } + for d in demands_in { + demands.push(register(&item_names, d)) + } + let mut chef_spawn = Vec2::new(0., 0.); let mut customer_spawn = Vec2::new(0., 0.); let mut initial_map = HashMap::new(); @@ -99,6 +109,7 @@ pub fn build_gamedata(recipes_in: Vec<RecipeDecl>, map_in: InitialMap) -> Gameda } Gamedata { + demands, recipes, initial_map, item_names: item_names.into_inner().unwrap(), |