aboutsummaryrefslogtreecommitdiff
path: root/internal/world/mob.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 18:38:35 -0400
committerhistoria <[not public]>2026-09-18 18:38:35 -0400
commit1f118d79e319da4e765502e9ca5b661772de94f1 (patch)
treebca8a3fd1e538f1c302480511e6ba872c92e10b8 /internal/world/mob.go
parent5ad42a51df4dcc5ccc3aa6a6d902085ce2ee4239 (diff)
downloadthehouseoficarus-1f118d79e319da4e765502e9ca5b661772de94f1.tar.gz
refactor: casino table core; fix: stake/migration/validation gaps
Diffstat (limited to 'internal/world/mob.go')
-rw-r--r--internal/world/mob.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/internal/world/mob.go b/internal/world/mob.go
index 631e3a3..afd9024 100644
--- a/internal/world/mob.go
+++ b/internal/world/mob.go
@@ -428,9 +428,9 @@ func (s *MobStore) LoadDef(id string) (*MobDef, error) {
s.mu.Unlock()
return def, nil
}
- s.mu.Unlock()
-
+ // pathIndex is writer-guarded by ReloadDefs; read it under the lock too.
path, ok := s.pathIndex[id]
+ s.mu.Unlock()
if !ok {
return nil, fmt.Errorf("read mob %s: no such mob", id)
}
@@ -455,7 +455,9 @@ func (s *MobStore) LoadDef(id string) (*MobDef, error) {
}
func (s *MobStore) AllDefIDs() map[string]bool {
- ids := make(map[string]bool)
+ s.mu.Lock()
+ defer s.mu.Unlock()
+ ids := make(map[string]bool, len(s.pathIndex))
for id := range s.pathIndex {
ids[id] = true
}
@@ -757,5 +759,10 @@ func (s *MobStore) RekeyRooms(idMap map[int]int) {
inst.WanderRooms[i] = newID
}
}
+ for i, room := range inst.DespawnRooms {
+ if newID, ok := idMap[room]; ok && newID != room {
+ inst.DespawnRooms[i] = newID
+ }
+ }
}
}