diff options
| author | historia <[not public]> | 2026-09-15 15:35:52 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-15 15:35:52 -0400 |
| commit | 0b0b25222b3131ada79ff78c28eb8bf07d977deb (patch) | |
| tree | 2ceaef5203595044f66a8f00064cd8e017f8f48d /internal/game/cmd_registry.go | |
| parent | 396c3facb8287b9a34076cae8f3d7b300d366d99 (diff) | |
| download | thehouseoficarus-0b0b25222b3131ada79ff78c28eb8bf07d977deb.tar.gz | |
feat: single-owner game state, transactional lifecycle, durable money on server stop
Diffstat (limited to 'internal/game/cmd_registry.go')
| -rw-r--r-- | internal/game/cmd_registry.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/game/cmd_registry.go b/internal/game/cmd_registry.go index 0fee89e..9a42d1e 100644 --- a/internal/game/cmd_registry.go +++ b/internal/game/cmd_registry.go @@ -181,7 +181,10 @@ func classifyCommand(cmd string) CommandClass { if _, ok := verbAliases[cmd]; ok { return ClassActive } - if obstacleVerbs[cmd] { + obstacleVerbsMu.RLock() + isObstacle := obstacleVerbs[cmd] + obstacleVerbsMu.RUnlock() + if isObstacle { return ClassActive } return ClassUnknown @@ -211,7 +214,10 @@ func (g *Game) executeCommand(sess *net.Session, cmd string, args []string, rawI return } - if obstacleVerbs[cmd] { + obstacleVerbsMu.RLock() + isObstacle := obstacleVerbs[cmd] + obstacleVerbsMu.RUnlock() + if isObstacle { g.doObstacle(sess, cmd) return } |
