Complete the hand of a player who has joined after the start of the game
continuous-integration/drone/push Build is failing Details

main
Clément FRÉVILLE 2 years ago
parent 0288254f75
commit 12f39ef275

@ -58,6 +58,7 @@ impl Room {
}
}
let mut is_new_player = false;
if let Some(i) = player_index {
// Reclaim the player's spot
self.broadcast(ServerMessage::PlayerReconnected(i));
@ -65,6 +66,7 @@ impl Room {
} else {
self.broadcast(ServerMessage::PlayerConnected(player_name.clone()));
player_index = Some(self.players.len());
is_new_player = true;
self.players.push(Player {
name: player_name,
@ -90,6 +92,14 @@ impl Room {
has_started: self.has_started,
})?;
if self.has_started && is_new_player {
self.players[player_index]
.hand
.complete(&mut self.deck)
.ok();
self.sync_hand(player_index);
}
Ok(())
}

Loading…
Cancel
Save