diff options
| author | historia <[not public]> | 2026-09-18 15:42:23 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 15:42:23 -0400 |
| commit | 67e01aab85607b9e601185c7d62dff576af3bb43 (patch) | |
| tree | 059134b2434eba7c14aa9d89f48c5a475feb0312 /internal/world/world.go | |
| parent | 7eab582d8a8ee2af1a6baae7baf0696c7005de2e (diff) | |
| download | thehouseoficarus-67e01aab85607b9e601185c7d62dff576af3bb43.tar.gz | |
fix: close map OOM, admin traversal, transport safespot, room rekey, and legacy payout recovery
Diffstat (limited to 'internal/world/world.go')
| -rw-r--r-- | internal/world/world.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/internal/world/world.go b/internal/world/world.go index 6a0313d..7475ce0 100644 --- a/internal/world/world.go +++ b/internal/world/world.go @@ -217,6 +217,7 @@ func (w *World) RekeyRooms(idMap map[int]int) { type objKeyMove struct { oldKey, newKey string st *ObjState + newID int } var moves []objKeyMove for k, st := range w.objStates { @@ -233,12 +234,23 @@ func (w *World) RekeyRooms(idMap map[int]int) { continue } newKey := fmt.Sprintf("%d:%s", newID, k[len(roomStr)+1:]) - moves = append(moves, objKeyMove{k, newKey, st}) + moves = append(moves, objKeyMove{k, newKey, st, newID}) } for _, m := range moves { delete(w.objStates, m.oldKey) } for _, m := range moves { + // Keep the package invariant mapKey == ObjStateKey(st.RoomID, ...): + // object lookups filter on st.RoomID while GetObjState looks up the + // key, so a rekey that leaves RoomID stale makes the object vanish + // from the renamed room (and TickObjWander then creates a second + // entry for the same state). Remap wander rooms like MobStore does. + m.st.RoomID = m.newID + for i, room := range m.st.WanderRooms { + if mapped, ok := idMap[room]; ok && mapped != room { + m.st.WanderRooms[i] = mapped + } + } w.objStates[m.newKey] = m.st } } |
