From 3be0cfa0ea61a3c56e0efc7169be5f3e0d7009d3 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 18 Sep 2022 13:00:32 +0200 Subject: log dispatches and timeouts --- planetwars-matchrunner/src/pw_match.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'planetwars-matchrunner/src/pw_match.rs') diff --git a/planetwars-matchrunner/src/pw_match.rs b/planetwars-matchrunner/src/pw_match.rs index 03dd37c..4af215e 100644 --- a/planetwars-matchrunner/src/pw_match.rs +++ b/planetwars-matchrunner/src/pw_match.rs @@ -117,6 +117,9 @@ impl PwMatch { fn log_player_action(&mut self, player_id: usize, player_action: PlayerAction) { match player_action { + PlayerAction::Timeout => self.match_ctx.log(MatchLogMessage::Timeout { + player_id: player_id as u32, + }), PlayerAction::ParseError { data, error } => { // TODO: can this be handled better? let command = @@ -128,14 +131,19 @@ impl PwMatch { error: error.to_string(), }); } - // TODO: handle other action types - _ => {} + PlayerAction::Commands(dispatches) => { + self.match_ctx.log(MatchLogMessage::Dispatches { + player_id: player_id as u32, + dispatches, + }); + } } } } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct PlayerCommand { + #[serde(flatten)] pub command: proto::Command, #[serde(skip_serializing_if = "Option::is_none")] pub error: Option, -- cgit v1.2.3