aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-02-03 20:46:40 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-02-03 20:46:40 +0100
commit0a102a93716d85d7a1c3ef280761d615cfdd738b (patch)
treea38864ea2bb2bbbc5976ee9654f3e5855f155fc2
parentaf7627d346725c974b012df8eb6ebc2a630adf4c (diff)
downloadplanetwars.dev-0a102a93716d85d7a1c3ef280761d615cfdd738b.tar.xz
planetwars.dev-0a102a93716d85d7a1c3ef280761d615cfdd738b.zip
remove send_info method
-rw-r--r--planetwars-matchrunner/src/bot_runner.rs5
-rw-r--r--planetwars-matchrunner/src/docker_runner.rs5
-rw-r--r--planetwars-matchrunner/src/lib.rs2
-rw-r--r--planetwars-matchrunner/src/match_context.rs6
-rw-r--r--planetwars-matchrunner/src/pw_match.rs2
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<Mutex<EventBus>>, 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<u32> {
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();