aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/manager.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/casino/manager.go')
-rw-r--r--internal/casino/manager.go17
1 files changed, 5 insertions, 12 deletions
diff --git a/internal/casino/manager.go b/internal/casino/manager.go
index 5fa6439..c9dde5a 100644
--- a/internal/casino/manager.go
+++ b/internal/casino/manager.go
@@ -10,7 +10,6 @@ import (
"strconv"
"strings"
"sync"
- "time"
)
type Manager struct {
@@ -162,12 +161,10 @@ func (m *Manager) snapshotMachines() []*Machine {
return machines
}
-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 {
+// Tick advances every table and machine by one engine tick. Game rules are
+// tick-based, so no wall-clock duration crosses this boundary; owner ordering
+// and deterministic tests remain intact.
+func (m *Manager) Tick() []Event {
tables := m.snapshotTables()
sort.Slice(tables, func(i, j int) bool {
if tables[i].RoomID != tables[j].RoomID {
@@ -177,11 +174,7 @@ func (m *Manager) TickElapsed(elapsed time.Duration) []Event {
})
var events []Event
for _, table := range tables {
- if game, ok := table.game.(interface{ tickElapsed(time.Duration) []Event }); ok {
- events = append(events, game.tickElapsed(elapsed)...)
- } else {
- events = append(events, table.tick()...)
- }
+ events = append(events, table.tick()...)
}
machines := m.snapshotMachines()
sort.Slice(machines, func(i, j int) bool {