From 747f1fed135eaacd09094854e4c6425d911dda2a Mon Sep 17 00:00:00 2001 From: xavo95 Date: Fri, 13 Sep 2024 02:38:28 +0200 Subject: [PATCH] Tested setup --- game-server/src/logic/handler/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/game-server/src/logic/handler/mod.rs b/game-server/src/logic/handler/mod.rs index 3d00785..fde196f 100644 --- a/game-server/src/logic/handler/mod.rs +++ b/game-server/src/logic/handler/mod.rs @@ -4,22 +4,22 @@ pub use scene::*; use shorekeeper_protocol::message::Message; macro_rules! handle_request { - ($($name:ident;)*) => { + ($($name:ident $(, $inner_package:ident)?;)*) => { fn handle_request(player: &mut super::player::Player, mut msg: Message) { use ::shorekeeper_protocol::{MessageID, Protobuf}; ::paste::paste! { match msg.get_message_id() { $( - ::shorekeeper_protocol::[<$name Request>]::MESSAGE_ID => { - let Ok(request) = ::shorekeeper_protocol::[<$name Request>]::decode(&*msg.remove_payload()) else { - tracing::debug!("failed to decode {}, player_id: {}", stringify!([<$name Request>]), player.basic_info.id); + ::shorekeeper_protocol::$($inner_package::)?[<$name Request>]::MESSAGE_ID => { + let Ok(request) = ::shorekeeper_protocol::$($inner_package::)?[<$name Request>]::decode(&*msg.remove_payload()) else { + tracing::debug!("failed to decode {}, player_id: {}", stringify!($($inner_package::)?[<$name Request>]), player.basic_info.id); return; }; - tracing::debug!("logic: processing request {}", stringify!([<$name Request>])); + tracing::debug!("logic: processing request {}", stringify!($($inner_package::)?[<$name Request>])); - let mut response = ::shorekeeper_protocol::[<$name Response>]::default(); + let mut response = ::shorekeeper_protocol::$($inner_package::)?[<$name Response>]::default(); [](player, request, &mut response); player.respond(response, msg.get_rpc_id());