From 396c3facb8287b9a34076cae8f3d7b300d366d99 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 15 Sep 2026 14:18:14 -0400 Subject: fix: atomic saves, casino RNG/config isolation, tick lifecycle --- internal/casino/slots.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'internal/casino/slots.go') 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 -- cgit v1.2.3