diff --git a/src/AcDream.App/Rendering/GameWindow.cs b/src/AcDream.App/Rendering/GameWindow.cs index b0dacd3..b323bed 100644 --- a/src/AcDream.App/Rendering/GameWindow.cs +++ b/src/AcDream.App/Rendering/GameWindow.cs @@ -1870,7 +1870,7 @@ public sealed class GameWindow : IDisposable _terrain?.RemoveLandblock(id); _physicsEngine.RemoveLandblock(id); _cellVisibility.RemoveLandblock((id >> 16) & 0xFFFFu); - _buildingRegistries.Remove(id); // Phase A8 + _buildingRegistries.Remove(id & 0xFFFF0000u); // Phase A8 (key normalization fix 2026-05-28) _envCellRenderer?.RemoveLandblock(id); // Phase A8 }); // A.5 T22.5: apply max-completions from resolved quality. @@ -5907,7 +5907,18 @@ public sealed class GameWindow : IDisposable if (!lbStampCells.ContainsKey(c.CellId)) lbStampCells[c.CellId] = c; } - _buildingRegistries[lb.LandblockId] = + // FIX 2026-05-28: normalize storage key to the cell-prefix + // convention (`landblockId & 0xFFFF0000u`). The lb.LandblockId + // field encodes 0xXXYY_FFFF (low 16 bits = 0xFFFF for the + // landblock's own LandBlockInfo dat id), but the runtime + // lookup at line ~7110 derives the key from a cell id via + // `cellId & 0xFFFF0000u` which yields 0xXXYY_0000. Storage + // and lookup must agree. Mask both sides to the upper-16 + // form so the registry resolves correctly. This is the same + // bug the RR7.2 commit (`efe3520`, reverted by `9aaae02`) + // tried to fix; landing it here in the data-flow layer. + uint regKey = lb.LandblockId & 0xFFFF0000u; + _buildingRegistries[regKey] = AcDream.App.Rendering.Wb.BuildingLoader.Build( lbInfo, lb.LandblockId, lbStampCells); } @@ -9036,7 +9047,7 @@ public sealed class GameWindow : IDisposable _terrain?.RemoveLandblock(id); _physicsEngine.RemoveLandblock(id); _cellVisibility.RemoveLandblock((id >> 16) & 0xFFFFu); - _buildingRegistries.Remove(id); // Phase A8 + _buildingRegistries.Remove(id & 0xFFFF0000u); // Phase A8 (key normalization fix 2026-05-28) _envCellRenderer?.RemoveLandblock(id); // Phase A8 }); _streamingController.MaxCompletionsPerFrame = newResolved.MaxCompletionsPerFrame;