From: Geoffrey Allott Date: Sun, 21 Mar 2021 11:48:46 +0000 (+0000) Subject: wait for player if start time has already passed X-Git-Url: https://git.pointlesshacks.com/?a=commitdiff_plain;h=633a8ef142344010a2a2920f558250fd284e886d;p=pokerwave.git wait for player if start time has already passed --- diff --git a/src/game/poker/holdem.rs b/src/game/poker/holdem.rs index dd624fa..64ef9ac 100644 --- a/src/game/poker/holdem.rs +++ b/src/game/poker/holdem.rs @@ -492,7 +492,10 @@ impl Game for TexasHoldEm { DealerAction::WaitForPlayer } StartCondition::AtTime(start_time) => { - if timestamp >= start_time && self.seats.players_len() >= 2 { + if timestamp >= start_time { + if self.seats.players_len() < 2 { + return DealerAction::WaitForPlayer + } if let Some(username) = rng.choose_from(self.seats.player_set()) { return DealerAction::TakeAction(ValidatedUserAction(UserAction { timestamp, username, action: Action::NextToDeal })); } diff --git a/src/game/whist.rs b/src/game/whist.rs index 912ac6a..7773a7c 100644 --- a/src/game/whist.rs +++ b/src/game/whist.rs @@ -317,7 +317,10 @@ impl Game for KnockOutWhist { DealerAction::WaitForPlayer } StartCondition::AtTime(start_time) => { - if timestamp >= start_time && self.seats.players_len() >= 2 { + if timestamp >= start_time { + if self.seats.players_len() < 2 { + return DealerAction::WaitForPlayer + } if let Some(username) = rng.choose_from(self.seats.player_set()) { return DealerAction::TakeAction(ValidatedUserAction(UserAction { timestamp, username, action: Action::NextToDeal })); }