Send the complete board when joining a room
This commit is contained in:
@@ -71,6 +71,7 @@ impl Room {
|
||||
.iter()
|
||||
.map(|p| (p.name.clone(), p.score, p.ws.is_some()))
|
||||
.collect(),
|
||||
board: (&self.board).into(),
|
||||
active_player: self.active_player,
|
||||
has_started: self.has_started,
|
||||
})?;
|
||||
@@ -103,7 +104,7 @@ impl Room {
|
||||
ClientMessage::TileUse(pos, tile_idx) => {
|
||||
if let Some(p) = self.connections.get(&addr) {
|
||||
if *p == self.active_player {
|
||||
self.on_tile_use(pos, tile_idx);
|
||||
self.on_tile_use(pos.into(), tile_idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,7 +177,7 @@ impl Room {
|
||||
fn reset_player_moves(&mut self) {
|
||||
let diff = self.board.difference(&self.validated_board);
|
||||
for pos in diff {
|
||||
self.broadcast(ServerMessage::TileRemoved(pos));
|
||||
self.broadcast(ServerMessage::TileRemoved(pos.into()));
|
||||
}
|
||||
self.board = self.validated_board.clone();
|
||||
}
|
||||
|
Reference in New Issue
Block a user