From 633a8ef142344010a2a2920f558250fd284e886d Mon Sep 17 00:00:00 2001 From: Geoffrey Allott Date: Sun, 21 Mar 2021 11:48:46 +0000 Subject: [PATCH] wait for player if start time has already passed --- src/game/poker/holdem.rs | 5 ++++- src/game/whist.rs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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 })); } -- 2.34.1