diff options
| author | historia <[not public]> | 2026-10-05 17:39:06 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-10-05 17:39:06 -0400 |
| commit | ec703a39738fefb60817f5659f76f8e683f8d301 (patch) | |
| tree | 00d1242d9f94bc2fec48331d8c02909be6b37f7a /internal/casino | |
| parent | 516fd29da423432ef6dfded21a984f1d15dcab1a (diff) | |
| download | thehouseoficarus-ec703a39738fefb60817f5659f76f8e683f8d301.tar.gz | |
fix: admin undo/redo failure, video poker cabinet ids, room ref behavior
Diffstat (limited to 'internal/casino')
| -rw-r--r-- | internal/casino/config_validate.go | 6 | ||||
| -rw-r--r-- | internal/casino/correct_audit_fixes_test.go | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/internal/casino/config_validate.go b/internal/casino/config_validate.go index 74dc0a4..41d5b83 100644 --- a/internal/casino/config_validate.go +++ b/internal/casino/config_validate.go @@ -359,8 +359,12 @@ func ValidateRoomConfigs(tables []TableConfig, machines []MachineConfig) error { for _, c := range tables { check("table", c.ID, c.Validate()) if c.Game == GameVideoPoker { + // Cabinets are addressed by their unique ID (not the game name), so + // claim the ID as an address. Skipping the claim let a cabinet ID + // collide with a machine variant/game name and become unreachable. + checkAddressable(strings.ToLower(c.ID), c.ID) continue - } // Cabinets are addressed by unique ID, not game name. + } checkAddressable(strings.ToLower(string(c.Game)), c.ID) } // A machine addresses by its variant when one is declared; a bare game diff --git a/internal/casino/correct_audit_fixes_test.go b/internal/casino/correct_audit_fixes_test.go index e5e3bd3..dc33c47 100644 --- a/internal/casino/correct_audit_fixes_test.go +++ b/internal/casino/correct_audit_fixes_test.go @@ -21,3 +21,14 @@ func TestCrapsShooterChangeResetsHand(t *testing.T) { t.Fatalf("new shooter inherited hand: point=%d rolled=%v made=%v seen=%v", tb.point, tb.rolled, tb.made, tb.seen) } } + +// Regression: a video-poker cabinet addressed by an ID that collides with a +// machine variant/game name validated but was unreachable (the machine won the +// address lookup). +func TestVideoPokerCabinetIDCollisionIsRejected(t *testing.T) { + machines := []MachineConfig{{ID: "m1", Game: GameSlots, Variant: "x"}} + tables := []TableConfig{{ID: "x", Game: GameVideoPoker}} + if err := ValidateRoomConfigs(tables, machines); err == nil { + t.Fatal("cabinet ID colliding with a machine variant was accepted; the cabinet would be unreachable") + } +} |
