aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/types.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/types.go')
-rw-r--r--internal/casino/types.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/casino/types.go b/internal/casino/types.go
index 283aa43..49e2cc4 100644
--- a/internal/casino/types.go
+++ b/internal/casino/types.go
@@ -128,6 +128,12 @@ func (c MachineConfig) Normalize() MachineConfig {
if c.MaxBet <= 0 {
c.MaxBet = DefaultMaxBet
}
+ // Never leave a normalized config self-contradictory: a min_bet above
+ // the default cap must widen the effective maximum rather than produce
+ // a game every wager is rejected from.
+ if c.MaxBet < c.MinBet {
+ c.MaxBet = c.MinBet
+ }
if c.SpinTicks <= 0 {
c.SpinTicks = 2
}
@@ -153,6 +159,9 @@ func (c TableConfig) Normalize() TableConfig {
if c.MaxBet <= 0 {
c.MaxBet = DefaultMaxBet
}
+ if c.MaxBet < c.MinBet {
+ c.MaxBet = c.MinBet
+ }
return c
}