aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/pai_gow.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/pai_gow.go')
-rw-r--r--internal/casino/pai_gow.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/internal/casino/pai_gow.go b/internal/casino/pai_gow.go
index a2dafcf..8f581db 100644
--- a/internal/casino/pai_gow.go
+++ b/internal/casino/pai_gow.go
@@ -747,8 +747,11 @@ func (t *paiGowTable) tick() []Event {
if t.allBetLocked() {
return t.dealLocked()
}
- // A lone player has no time limit; wait for their bet instead.
- if t.activePlayersLocked() <= 1 {
+ // A lone seated player has no time limit; wait for their bet instead.
+ // Count seated players, not bettors: with one bettor and one idle seat
+ // activePlayersLocked() is 1 forever, so the window never closes and
+ // the round stalls.
+ if t.seatedPlayersLocked() <= 1 {
return nil
}
t.ticks--
@@ -901,6 +904,18 @@ func (t *paiGowTable) activePlayersLocked() int {
return n
}
+// seatedPlayersLocked counts connected seats, bettors or not. The betting
+// window is bounded by seats present, so an idle seat still lets it expire.
+func (t *paiGowTable) seatedPlayersLocked() int {
+ n := 0
+ for _, p := range t.players {
+ if !p.disconnected {
+ n++
+ }
+ }
+ return n
+}
+
// unbetLocked takes back every wager before the deal. Refunds go through
// PayCredits with the original stake handles so the ledger entries resolve in
// the same save; wagers are only cleared on success.