diff options
| author | historia <[not public]> | 2026-09-18 18:38:35 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 18:38:35 -0400 |
| commit | 1f118d79e319da4e765502e9ca5b661772de94f1 (patch) | |
| tree | bca8a3fd1e538f1c302480511e6ba872c92e10b8 /internal/world/mob.go | |
| parent | 5ad42a51df4dcc5ccc3aa6a6d902085ce2ee4239 (diff) | |
| download | thehouseoficarus-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.go | 13 |
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 + } + } } } |
