aboutsummaryrefslogtreecommitdiff
path: root/server/data/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/data/src/lib.rs')
-rw-r--r--server/data/src/lib.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/server/data/src/lib.rs b/server/data/src/lib.rs
index aff895fa..53b4e802 100644
--- a/server/data/src/lib.rs
+++ b/server/data/src/lib.rs
@@ -87,7 +87,7 @@ struct TileArgs {
#[derive(Debug, Clone, Default)]
#[rustfmt::skip]
-pub struct Serverdata {
+pub struct PrivateGamedata {
pub initial_map: HashMap<IVec2, (Vec<TileIndex>, Option<ItemIndex>)>,
pub chef_spawn: Vec2,
pub customer_spawn: Option<Vec2>,
@@ -98,11 +98,18 @@ pub struct Serverdata {
pub recipe_groups: BTreeMap<String, BTreeSet<ItemIndex>>,
}
-pub fn build_data(
+pub fn map_list(data_path: &Path) -> Result<Vec<(String, MapMetadata)>> {
+ let index =
+ read_to_string(data_path.join("index.yaml")).context("Failed reading data index")?;
+ let index = serde_yaml_ng::from_str::<DataIndex>(&index)?;
+ Ok(map_listing(&index))
+}
+
+pub fn build_gamedata(
data_path: &Path,
map_name: &str,
generate_book: bool,
-) -> Result<(Gamedata, Serverdata)> {
+) -> Result<(Gamedata, PrivateGamedata)> {
debug!("Preparing gamedata for {map_name}");
// Load index
@@ -234,7 +241,6 @@ pub fn build_data(
let mut data = Gamedata {
current_map: map_name.to_string(),
- maps: map_listing(&index),
tile_collide: tiles_flagged(&tile_flags, &tiles, 'c'),
tile_placeable_items: tile_placeable_items(
&initial_map,
@@ -251,15 +257,9 @@ pub fn build_data(
item_names: items,
demands,
tile_names: tiles,
- bot_algos: vec![
- "waiter".to_string(),
- "simple".to_string(),
- "dishwasher".to_string(),
- "frank".to_string(),
- ],
hand_count: map_in.hand_count.unwrap_or(1),
};
- let mut serverdata = Serverdata {
+ let mut serverdata = PrivateGamedata {
initial_map,
chef_spawn,
customer_spawn,