aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/slots.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-15 14:18:14 -0400
committerhistoria <[not public]>2026-09-15 14:18:14 -0400
commit396c3facb8287b9a34076cae8f3d7b300d366d99 (patch)
tree941f280d051fac474fa68ca08318a8d16adc8d0f /internal/casino/slots.go
parentb3568f03e4103dd46db2ccc680fbab0a6454d604 (diff)
downloadthehouseoficarus-396c3facb8287b9a34076cae8f3d7b300d366d99.tar.gz
fix: atomic saves, casino RNG/config isolation, tick lifecycle
Diffstat (limited to 'internal/casino/slots.go')
-rw-r--r--internal/casino/slots.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/casino/slots.go b/internal/casino/slots.go
index aba8f91..c519293 100644
--- a/internal/casino/slots.go
+++ b/internal/casino/slots.go
@@ -234,10 +234,15 @@ func ScaleToRTP(profile SlotProfile, target float64) SlotProfile {
return profile
}
scale := target / actual
+ // SlotProfile is a value API, but its slice and paytable maps are shared
+ // references. Clone both so tuning one machine cannot retune another.
+ profile.Symbols = append([]SlotSymbol(nil), profile.Symbols...)
for i := range profile.Symbols {
+ payouts := make(map[int]float64, len(profile.Symbols[i].Payout))
for length, payout := range profile.Symbols[i].Payout {
- profile.Symbols[i].Payout[length] = payout * scale
+ payouts[length] = payout * scale
}
+ profile.Symbols[i].Payout = payouts
}
profile.TargetRTP = target
return profile