diff options
| author | historia <[not public]> | 2026-09-30 05:33:45 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-30 05:33:45 -0400 |
| commit | 0fcb03633e3008169173d76c8408f5410592b3eb (patch) | |
| tree | 814797fb33a129b1c49f8ae309c6647027f5e528 /internal/casino/manager.go | |
| parent | 735428f0667f67c12fdf3caca872d7dc65e2ce26 (diff) | |
| download | thehouseoficarus-0fcb03633e3008169173d76c8408f5410592b3eb.tar.gz | |
feat: bank craps added to casino
Diffstat (limited to 'internal/casino/manager.go')
| -rw-r--r-- | internal/casino/manager.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/internal/casino/manager.go b/internal/casino/manager.go index f880463..2162656 100644 --- a/internal/casino/manager.go +++ b/internal/casino/manager.go @@ -10,6 +10,7 @@ import ( "strconv" "strings" "sync" + "time" ) type Manager struct { @@ -161,7 +162,12 @@ func (m *Manager) snapshotMachines() []*Machine { return machines } -func (m *Manager) Tick() []Event { +func (m *Manager) Tick() []Event { return m.TickElapsed(600 * time.Millisecond) } + +// TickElapsed supplies the engine cadence to games with real-time deadlines. +// Legacy games retain their tick-based rules. No wall clock or goroutine is +// introduced, so owner ordering and deterministic tests remain intact. +func (m *Manager) TickElapsed(elapsed time.Duration) []Event { tables := m.snapshotTables() sort.Slice(tables, func(i, j int) bool { if tables[i].RoomID != tables[j].RoomID { @@ -171,7 +177,11 @@ func (m *Manager) Tick() []Event { }) var events []Event for _, table := range tables { - events = append(events, table.tick()...) + if game, ok := table.game.(interface{ tickElapsed(time.Duration) []Event }); ok { + events = append(events, game.tickElapsed(elapsed)...) + } else { + events = append(events, table.tick()...) + } } machines := m.snapshotMachines() sort.Slice(machines, func(i, j int) bool { |
