aboutsummaryrefslogtreecommitdiff
path: root/internal/casino
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 20:11:29 -0400
committerhistoria <[not public]>2026-09-18 20:11:29 -0400
commit0f812ccc307ea0550511ccced40b65dfb0cdaa91 (patch)
tree7f2f343985275a478ba7295a37fcd48871ca4956 /internal/casino
parent79764732406d6484f67d3dec045483dcb5d08c28 (diff)
downloadthehouseoficarus-0f812ccc307ea0550511ccced40b65dfb0cdaa91.tar.gz
fix: world and casino integrity fixes
Diffstat (limited to 'internal/casino')
-rw-r--r--internal/casino/credits.go6
-rw-r--r--internal/casino/manager.go6
-rw-r--r--internal/casino/money_regression_test.go2
3 files changed, 9 insertions, 5 deletions
diff --git a/internal/casino/credits.go b/internal/casino/credits.go
index 631a4bc..19364da 100644
--- a/internal/casino/credits.go
+++ b/internal/casino/credits.go
@@ -76,6 +76,10 @@ func walletErrorMessage(err error, context ...string) string {
// payoutFailedMessage explains a settlement the wallet could not persist:
// the journal record for the payout stays open, so startup recovery will
// re-apply the owed amount. Games must NOT announce such a payout as paid.
+// payoutFailedMessage explains a settlement the wallet could not apply right
+// now. This covers both a persistence failure and a credit-cap block (the
+// journal record stays open either way), so it must not assert a persistence
+// failure as the cause. Recovery re-applies the owed amount.
func payoutFailedMessage() string {
- return "The house could not process your payout (persistence failure). Your settlement is recorded and will be restored when you return."
+ return "The house could not process your payout right now. Your settlement is recorded and will be restored when you return."
}
diff --git a/internal/casino/manager.go b/internal/casino/manager.go
index b71e5df..d9b2c3e 100644
--- a/internal/casino/manager.go
+++ b/internal/casino/manager.go
@@ -75,9 +75,9 @@ func (m *Manager) EnsureMachine(roomID int, cfg MachineConfig) *Machine {
m.mu.Lock()
defer m.mu.Unlock()
if machine := m.machines[key]; machine != nil {
- // DeepEqual (not ==) so the *bool rule fields compare by value;
- // == would treat every freshly parsed config as different and
- // discard an idle machine on every room load.
+ // DeepEqual (not ==) compares the config by value and stays correct
+ // as rule structs gain pointer/slice fields; == would panic or, for
+ // a struct with incomparable fields, fail to compile.
if reflect.DeepEqual(machine.Config, cfg) {
return machine
}
diff --git a/internal/casino/money_regression_test.go b/internal/casino/money_regression_test.go
index 31cd0e6..bb8263e 100644
--- a/internal/casino/money_regression_test.go
+++ b/internal/casino/money_regression_test.go
@@ -129,7 +129,7 @@ func TestBlackjackFailedPayoutNotAnnouncedAsPaid(t *testing.T) {
if strings.Contains(e.PrivateMessage, "You win! +") {
t.Fatalf("announced a successful payout after the wallet rejected it: %q", e.PrivateMessage)
}
- if strings.Contains(e.PrivateMessage, "persistence failure") {
+ if strings.Contains(e.PrivateMessage, "could not process your payout") {
return // the failure was explained to the player
}
}