summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-06-27 17:21:52 +0200
committermetamuffin <metamuffin@disroot.org>2024-06-27 17:21:52 +0200
commit82408a6d478ed9f7009482c69f1f4d69025c833d (patch)
tree2d27c799917c2d44417882fd04cfff37e25cd18b /server/src
parent4fa692dae19789e5e766c50ac31874653d02971a (diff)
parent86eaa98918760ed829f23a70f15604bf751549be (diff)
downloadhurrycurry-82408a6d478ed9f7009482c69f1f4d69025c833d.tar
hurrycurry-82408a6d478ed9f7009482c69f1f4d69025c833d.tar.bz2
hurrycurry-82408a6d478ed9f7009482c69f1f4d69025c833d.tar.zst
Merge branch 'master' of https://codeberg.org/metamuffin/undercooked
Diffstat (limited to 'server/src')
-rw-r--r--server/src/data.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/server/src/data.rs b/server/src/data.rs
index e2944e3d..6b0442ce 100644
--- a/server/src/data.rs
+++ b/server/src/data.rs
@@ -19,7 +19,7 @@ use crate::{
interaction::Recipe,
protocol::{DemandIndex, ItemIndex, RecipeIndex, TileIndex},
};
-use anyhow::{anyhow, bail, Result};
+use anyhow::{anyhow, bail, Context, Result};
use glam::{IVec2, Vec2};
use serde::{Deserialize, Serialize};
use std::{
@@ -142,9 +142,12 @@ impl DataIndex {
let map_path = data_dir().join(format!("maps/{map}.yaml"));
let recipes_path = data_dir().join(format!("recipes/{recipes}.yaml"));
- let demands_in = serde_yaml::from_reader(File::open(demands_path).unwrap()).unwrap();
- let map_in = serde_yaml::from_reader(File::open(map_path).unwrap()).unwrap();
- let recipes_in = serde_yaml::from_reader(File::open(recipes_path).unwrap()).unwrap();
+ let demands_in =
+ serde_yaml::from_reader(File::open(demands_path).context("opening demands failed")?)?;
+ let map_in = serde_yaml::from_reader(File::open(map_path).context("opening map failed")?)?;
+ let recipes_in = serde_yaml::from_reader(
+ File::open(recipes_path).context("opening recipes failed. are they generated yet?")?,
+ )?;
Ok(Gamedata::build(recipes_in, map_in, demands_in)?)
}