diff options
Diffstat (limited to 'server/src/main.rs')
-rw-r--r-- | server/src/main.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/server/src/main.rs b/server/src/main.rs index 7426e27e..441487e8 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -1,7 +1,7 @@ use anyhow::Result; use futures_util::{SinkExt, StreamExt}; use log::{debug, info, warn}; -use std::{sync::Arc, time::Duration}; +use std::{fs::File, sync::Arc, time::Duration}; use tokio::{ io::{AsyncBufReadExt, AsyncWriteExt, BufReader}, net::TcpListener, @@ -13,6 +13,7 @@ use tokio_tungstenite::tungstenite::Message; use undercooked::{ game::Game, protocol::{PacketC, PacketS}, + recipes::build_gamedata, }; #[tokio::main] @@ -26,7 +27,10 @@ async fn main() -> Result<()> { ); info!("listening for websockets on {}", ws_listener.local_addr()?); - let game = Arc::new(RwLock::new(Game::new())); + let data = + build_gamedata(serde_yaml::from_reader(File::open("data/recipes.yaml").unwrap()).unwrap()); + + let game = Arc::new(RwLock::new(Game::new(data.into()))); let (tx, rx) = broadcast::channel::<PacketC>(1024); { |