From 74ffa47147d2bb989057b4513075975c44c2bc42 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 1 Mar 2026 21:55:16 +0100 Subject: add serverdata packet with data fields that dont change across games; add motd and server name --- server/src/main.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'server/src/main.rs') diff --git a/server/src/main.rs b/server/src/main.rs index cf133203..f1af7c54 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -68,10 +68,12 @@ pub(crate) struct Args { #[arg(long)] upnp: bool, /// Server name - #[cfg(any(feature = "register", feature = "mdns"))] #[arg(long, short = 'N', default_value = "A Hurry Curry! Server")] server_name: String, - /// Uri for connecting remotely for registry submission + /// Message of the day + #[arg(long, short = 'M')] + motd: Option, + /// URI for connecting remotely for registry submission #[cfg(feature = "register")] #[arg(long)] register_uri: Option, @@ -140,6 +142,8 @@ async fn run(data_path: PathBuf, args: Args) -> anyhow::Result<()> { inactivity_timeout: args.inactivity_timeout, lobby: args.lobby, data_path, + motd: args.motd, + name: args.server_name.clone(), }; let mut state = Server::new(config, tx)?; @@ -342,7 +346,7 @@ fn find_data_path() -> Result { #[cfg(test)] mod test { - use hurrycurry_data::build_data; + use hurrycurry_data::build_gamedata; use hurrycurry_protocol::{Character, PacketS, PlayerClass, PlayerID}; use hurrycurry_server::{ ConnectionID, @@ -376,7 +380,7 @@ mod test { fn map_load() { let mut s = server(); s.load( - build_data(&s.config.data_path, "junior", false).unwrap(), + build_gamedata(&s.config.data_path, "junior", false).unwrap(), None, ); } @@ -384,7 +388,7 @@ mod test { fn map_load_book() { let mut s = server(); s.load( - build_data(&s.config.data_path, "junior", true).unwrap(), + build_gamedata(&s.config.data_path, "junior", true).unwrap(), None, ); } -- cgit v1.3