aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-07-11 15:10:39 +0200
committermetamuffin <metamuffin@disroot.org>2024-07-11 15:10:39 +0200
commit17e7cb63bf70b35a58cf52ebea4bb543c450320f (patch)
tree1994196c3f01f12a634f31692523f664ba3cd434
parent50248f4e579573ff75c966fbbd5433101851f4b7 (diff)
downloadhurrycurry-17e7cb63bf70b35a58cf52ebea4bb543c450320f.tar
hurrycurry-17e7cb63bf70b35a58cf52ebea4bb543c450320f.tar.bz2
hurrycurry-17e7cb63bf70b35a58cf52ebea4bb543c450320f.tar.zst
add backwards compat for game jam release
-rw-r--r--server/protocol/src/lib.rs6
-rw-r--r--server/src/game.rs8
2 files changed, 13 insertions, 1 deletions
diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs
index cb72d2ff..2287633d 100644
--- a/server/protocol/src/lib.rs
+++ b/server/protocol/src/lib.rs
@@ -17,7 +17,10 @@
*/
use glam::{IVec2, Vec2};
use serde::{Deserialize, Serialize};
-use std::{collections::HashMap, fmt::Display};
+use std::{
+ collections::{HashMap, HashSet},
+ fmt::Display,
+};
pub use glam;
@@ -52,6 +55,7 @@ pub struct ClientGamedata {
pub tile_names: Vec<String>,
pub tile_collide: Vec<bool>,
pub tile_interact: Vec<bool>,
+ pub map_names: HashSet<String>, // for compat with game jam version
pub maps: HashMap<String, MapMetadata>,
}
diff --git a/server/src/game.rs b/server/src/game.rs
index f196fd1f..1c50c7c2 100644
--- a/server/src/game.rs
+++ b/server/src/game.rs
@@ -169,6 +169,14 @@ impl Game {
tile_names: self.data.tile_names.clone(),
tile_collide: self.data.tile_collide.clone(),
tile_interact: self.data.tile_interact.clone(),
+ map_names: self
+ .data
+ .map
+ .clone()
+ .keys()
+ .filter(|n| n.as_str() != "lobby")
+ .map(|s| s.to_owned())
+ .collect(),
maps: self
.data
.map