From 1f118d79e319da4e765502e9ca5b661772de94f1 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 18 Sep 2026 18:38:35 -0400 Subject: refactor: casino table core; fix: stake/migration/validation gaps --- internal/world/mob.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'internal/world/mob.go') 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 + } + } } } -- cgit v1.2.3