aboutsummaryrefslogtreecommitdiff
path: root/internal/game/hacking/liars_dice.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-16 13:52:58 -0400
committerhistoria <[not public]>2026-09-16 13:52:58 -0400
commitc054b27f628f23fecc505b9e09e78721738f3c4e (patch)
treeea197165bc454ee811dd22b9ceef5dc94bb0b279 /internal/game/hacking/liars_dice.go
parentf2d44f10f52d3fe68fdb19b518a330f7af9e1ed2 (diff)
downloadthehouseoficarus-c054b27f628f23fecc505b9e09e78721738f3c4e.tar.gz
fix: shutdown admission, recovery identity/order, rollback journal retention, pickup merge
Diffstat (limited to 'internal/game/hacking/liars_dice.go')
-rw-r--r--internal/game/hacking/liars_dice.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/internal/game/hacking/liars_dice.go b/internal/game/hacking/liars_dice.go
index 1dd27b6..8e21b94 100644
--- a/internal/game/hacking/liars_dice.go
+++ b/internal/game/hacking/liars_dice.go
@@ -175,7 +175,7 @@ func (l *LiarsDiceGame) doCall(player bool) (string, bool, bool) {
}
}
- return l.checkGameOver(sb)
+ return l.checkGameOver(&sb)
}
func (l *LiarsDiceGame) doExact() (string, bool, bool) {
@@ -202,10 +202,14 @@ func (l *LiarsDiceGame) doExact() (string, bool, bool) {
l.playerLost++
}
- return l.checkGameOver(sb)
+ return l.checkGameOver(&sb)
}
-func (l *LiarsDiceGame) checkGameOver(sb strings.Builder) (string, bool, bool) {
+// checkGameOver resolves a completed challenge/exact exchange. The builder is
+// passed BY POINTER: it already holds the resolution text, and copying a
+// non-zero strings.Builder by value panics — a panic here runs on the game
+// owner goroutine, which has no recovery, so it would terminate the server.
+func (l *LiarsDiceGame) checkGameOver(sb *strings.Builder) (string, bool, bool) {
if len(l.playerDice) == 0 {
sb.WriteString("\nYou've lost all your fragments. Connection terminated.")
l.gameOver = true