aboutsummaryrefslogtreecommitdiff
path: root/server/protocol/src/lib.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2026-03-01 21:55:16 +0100
committermetamuffin <metamuffin@disroot.org>2026-03-01 21:55:16 +0100
commit74ffa47147d2bb989057b4513075975c44c2bc42 (patch)
tree0a2242b25fefcf62f94ac6b712c9e937e3b8e35c /server/protocol/src/lib.rs
parentd6acbd76a81bb97c1ff74a66a2af9b00713ca6d0 (diff)
downloadhurrycurry-74ffa47147d2bb989057b4513075975c44c2bc42.tar
hurrycurry-74ffa47147d2bb989057b4513075975c44c2bc42.tar.bz2
hurrycurry-74ffa47147d2bb989057b4513075975c44c2bc42.tar.zst
add serverdata packet with data fields that dont change across games; add motd and server name
Diffstat (limited to 'server/protocol/src/lib.rs')
-rw-r--r--server/protocol/src/lib.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/server/protocol/src/lib.rs b/server/protocol/src/lib.rs
index 8a6e282e..db69f6be 100644
--- a/server/protocol/src/lib.rs
+++ b/server/protocol/src/lib.rs
@@ -81,8 +81,15 @@ pub struct Demand {
pub points: i64,
}
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct Serverdata {
+ pub name: String,
+ pub motd: Option<String>,
+ pub maps: Vec<(String, MapMetadata)>,
+ pub bot_algos: Vec<String>,
+}
+
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
-#[rustfmt::skip]
pub struct Gamedata {
pub current_map: String,
pub item_names: Vec<String>,
@@ -92,8 +99,6 @@ pub struct Gamedata {
pub tile_placeable_items: BTreeMap<TileIndex, HashSet<ItemIndex>>,
pub tile_placeable_any: HashSet<TileIndex>,
pub tile_interactable_empty: HashSet<TileIndex>,
- pub maps: Vec<(String, MapMetadata)>,
- pub bot_algos: Vec<String>,
pub recipes: Vec<Recipe>,
pub demands: Vec<Demand>,
pub hand_count: usize,
@@ -216,7 +221,10 @@ pub enum PacketC {
Joined {
id: PlayerID,
},
- Data {
+ ServerData {
+ data: Box<Serverdata>,
+ },
+ GameData {
data: Box<Gamedata>,
},
AddPlayer {