Tested setup
This commit is contained in:
parent
e5892ed9e5
commit
747f1fed13
1 changed files with 6 additions and 6 deletions
|
@ -4,22 +4,22 @@ pub use scene::*;
|
||||||
use shorekeeper_protocol::message::Message;
|
use shorekeeper_protocol::message::Message;
|
||||||
|
|
||||||
macro_rules! handle_request {
|
macro_rules! handle_request {
|
||||||
($($name:ident;)*) => {
|
($($name:ident $(, $inner_package:ident)?;)*) => {
|
||||||
fn handle_request(player: &mut super::player::Player, mut msg: Message) {
|
fn handle_request(player: &mut super::player::Player, mut msg: Message) {
|
||||||
use ::shorekeeper_protocol::{MessageID, Protobuf};
|
use ::shorekeeper_protocol::{MessageID, Protobuf};
|
||||||
|
|
||||||
::paste::paste! {
|
::paste::paste! {
|
||||||
match msg.get_message_id() {
|
match msg.get_message_id() {
|
||||||
$(
|
$(
|
||||||
::shorekeeper_protocol::[<$name Request>]::MESSAGE_ID => {
|
::shorekeeper_protocol::$($inner_package::)?[<$name Request>]::MESSAGE_ID => {
|
||||||
let Ok(request) = ::shorekeeper_protocol::[<$name Request>]::decode(&*msg.remove_payload()) else {
|
let Ok(request) = ::shorekeeper_protocol::$($inner_package::)?[<$name Request>]::decode(&*msg.remove_payload()) else {
|
||||||
tracing::debug!("failed to decode {}, player_id: {}", stringify!([<$name Request>]), player.basic_info.id);
|
tracing::debug!("failed to decode {}, player_id: {}", stringify!($($inner_package::)?[<$name Request>]), player.basic_info.id);
|
||||||
return;
|
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();
|
||||||
[<on_ $name:snake _request>](player, request, &mut response);
|
[<on_ $name:snake _request>](player, request, &mut response);
|
||||||
|
|
||||||
player.respond(response, msg.get_rpc_id());
|
player.respond(response, msg.get_rpc_id());
|
||||||
|
|
Loading…
Reference in a new issue