From 0a102a93716d85d7a1c3ef280761d615cfdd738b Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Thu, 3 Feb 2022 20:46:40 +0100 Subject: [PATCH] remove send_info method --- planetwars-matchrunner/src/bot_runner.rs | 5 ----- planetwars-matchrunner/src/docker_runner.rs | 5 ----- planetwars-matchrunner/src/lib.rs | 2 +- planetwars-matchrunner/src/match_context.rs | 6 ------ planetwars-matchrunner/src/pw_match.rs | 2 +- 5 files changed, 2 insertions(+), 18 deletions(-) diff --git a/planetwars-matchrunner/src/bot_runner.rs b/planetwars-matchrunner/src/bot_runner.rs index 70fc060..adb5907 100644 --- a/planetwars-matchrunner/src/bot_runner.rs +++ b/planetwars-matchrunner/src/bot_runner.rs @@ -22,11 +22,6 @@ impl PlayerHandle for LocalBotHandle { .send(r) .expect("failed to send message to local bot"); } - - fn send_info(&mut self, _msg: String) { - // TODO: log this somewhere - // drop info message - } } pub fn run_local_bot(player_id: u32, event_bus: Arc>, bot: Bot) -> LocalBotHandle { diff --git a/planetwars-matchrunner/src/docker_runner.rs b/planetwars-matchrunner/src/docker_runner.rs index 84101ef..5900d92 100644 --- a/planetwars-matchrunner/src/docker_runner.rs +++ b/planetwars-matchrunner/src/docker_runner.rs @@ -152,11 +152,6 @@ impl PlayerHandle for DockerBotHandle { .send(r) .expect("failed to send message to local bot"); } - - fn send_info(&mut self, _msg: String) { - // TODO: log this somewhere - // drop info message - } } pub struct DockerBotRunner { diff --git a/planetwars-matchrunner/src/lib.rs b/planetwars-matchrunner/src/lib.rs index 7eff489..170ac1e 100644 --- a/planetwars-matchrunner/src/lib.rs +++ b/planetwars-matchrunner/src/lib.rs @@ -42,7 +42,7 @@ pub struct MatchPlayer { } #[async_trait] -pub trait BotSpec : Send + Sync{ +pub trait BotSpec: Send + Sync { async fn run_bot( &self, player_id: u32, diff --git a/planetwars-matchrunner/src/match_context.rs b/planetwars-matchrunner/src/match_context.rs index 466da13..8161ed9 100644 --- a/planetwars-matchrunner/src/match_context.rs +++ b/planetwars-matchrunner/src/match_context.rs @@ -66,11 +66,6 @@ impl MatchCtx { }; } - pub fn send_info(&mut self, player_id: u32, msg: String) { - let player = self.players.get_mut(&player_id).unwrap(); - player.handle.send_info(msg); - } - pub fn players(&self) -> Vec { self.players.keys().cloned().collect() } @@ -83,7 +78,6 @@ impl MatchCtx { pub trait PlayerHandle: Send { fn send_request(&mut self, r: RequestMessage); - fn send_info(&mut self, msg: String); } struct PlayerData { diff --git a/planetwars-matchrunner/src/pw_match.rs b/planetwars-matchrunner/src/pw_match.rs index 42bc9d2..25f849e 100644 --- a/planetwars-matchrunner/src/pw_match.rs +++ b/planetwars-matchrunner/src/pw_match.rs @@ -45,7 +45,7 @@ impl PwMatch { let res = self.execute_action(player_id, turn); if let Some(err) = action_errors(res) { let info_str = serde_json::to_string(&err).unwrap(); - self.match_ctx.send_info(player_id as u32, info_str); + println!("player {}: {}", player_id, info_str); } } self.match_state.step();