Add more debug messages

This commit is contained in:
Pierre HUBERT 2022-09-13 19:12:16 +02:00
parent 001d4341de
commit 3ad384c85a
2 changed files with 4 additions and 0 deletions

View File

@ -65,6 +65,7 @@ impl Game {
/// Once the two player has been registered, the game may start
fn query_boats_disposition(&mut self) {
log::debug!("Query boats disposition");
assert_eq!(self.status, GameStatus::Created);
self.status = GameStatus::WaitingForBoatsDisposition;
self.players[0].query_boats_layout(&self.rules);
@ -74,6 +75,7 @@ impl Game {
/// Start fires exchange
fn start_fire_exchanges(&mut self) {
self.status = GameStatus::Started;
log::debug!("Start fire exchanges");
}
}
@ -113,6 +115,7 @@ impl Handler<SetBoatsLayout> for Game {
fn handle(&mut self, msg: SetBoatsLayout, _ctx: &mut Self::Context) -> Self::Result {
assert_eq!(self.status, GameStatus::WaitingForBoatsDisposition);
let player_index = self.player_id_by_uuid(msg.0);
log::debug!("Got boat disposition for player {}", player_index);
match player_index {
0 => self.map_0 = Some(GameMap::new(self.rules.clone(), msg.1)),
1 => self.map_1 = Some(GameMap::new(self.rules.clone(), msg.1)),

View File

@ -59,6 +59,7 @@ impl Actor for HumanPlayerWS {
// Start game, according to appropriate start mode
match &self.start_mode {
StartMode::Bot(rules) => {
log::debug!("Start play with a bot");
let game = Game::new(rules.clone()).start();
match rules.bot_type {