remove send_info method
This commit is contained in:
parent
af7627d346
commit
0a102a9371
5 changed files with 2 additions and 18 deletions
|
@ -22,11 +22,6 @@ impl PlayerHandle for LocalBotHandle {
|
||||||
.send(r)
|
.send(r)
|
||||||
.expect("failed to send message to local bot");
|
.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 {
|
pub fn run_local_bot(player_id: u32, event_bus: Arc<Mutex<EventBus>>, bot: Bot) -> LocalBotHandle {
|
||||||
|
|
|
@ -152,11 +152,6 @@ impl PlayerHandle for DockerBotHandle {
|
||||||
.send(r)
|
.send(r)
|
||||||
.expect("failed to send message to local bot");
|
.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 {
|
pub struct DockerBotRunner {
|
||||||
|
|
|
@ -42,7 +42,7 @@ pub struct MatchPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait BotSpec : Send + Sync{
|
pub trait BotSpec: Send + Sync {
|
||||||
async fn run_bot(
|
async fn run_bot(
|
||||||
&self,
|
&self,
|
||||||
player_id: u32,
|
player_id: u32,
|
||||||
|
|
|
@ -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> {
|
pub fn players(&self) -> Vec<u32> {
|
||||||
self.players.keys().cloned().collect()
|
self.players.keys().cloned().collect()
|
||||||
}
|
}
|
||||||
|
@ -83,7 +78,6 @@ impl MatchCtx {
|
||||||
|
|
||||||
pub trait PlayerHandle: Send {
|
pub trait PlayerHandle: Send {
|
||||||
fn send_request(&mut self, r: RequestMessage);
|
fn send_request(&mut self, r: RequestMessage);
|
||||||
fn send_info(&mut self, msg: String);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PlayerData {
|
struct PlayerData {
|
||||||
|
|
|
@ -45,7 +45,7 @@ impl PwMatch {
|
||||||
let res = self.execute_action(player_id, turn);
|
let res = self.execute_action(player_id, turn);
|
||||||
if let Some(err) = action_errors(res) {
|
if let Some(err) = action_errors(res) {
|
||||||
let info_str = serde_json::to_string(&err).unwrap();
|
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();
|
self.match_state.step();
|
||||||
|
|
Loading…
Reference in a new issue