feat(render): Phase A8 RR4 — wire BuildingRegistry into landblock load
LoadedCell.BuildingId (init + internal setter) — set exactly once at
landblock load time by BuildingLoader; null when the cell isn't
part of any building (outdoor surface cells; dungeon cells not
enumerated in LandBlockInfo.Buildings).
GameWindow landblock-load path: builds BuildingRegistry from
LandBlockInfo.Buildings; stamps each cell's BuildingId; stores the
registry on _buildingRegistries[landblockId] (GameWindow-level dict)
for render-frame lookups. Note: LoadedLandblock is AcDream.Core.World
(a sealed record) — adding an App-type field there would violate
Code Structure Rule #2, so the registry is stored in a new
GameWindow-level dictionary instead. Cleanup wired in both
removeTerrain lambdas (OnLoad + OnResize paths).
drainedCells dict: the existing _pendingCells drain loop is extended
to also build a local CellId→LoadedCell dict; BuildingLoader.Build
uses this dict for the stamping pass so no second iteration is needed.
New BuildingLoaderTest verifies the stamping path. 5 BuildingLoader
tests total (4 from RR3 + 1 new).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f125fdb220
commit
f8d0499d8b
4 changed files with 93 additions and 4 deletions
|
|
@ -26,7 +26,7 @@ namespace AcDream.App.Rendering.Wb;
|
|||
/// unloaded cell). In production, streaming loads all cells for a landblock
|
||||
/// before <see cref="Build"/> runs, so the dict is always complete.</para>
|
||||
///
|
||||
/// <para><c>LoadedCell.BuildingId</c> stamping is wired in RR4, not here.</para>
|
||||
/// <para><c>LoadedCell.BuildingId</c> is stamped here in RR4 after <c>reg.Add(building)</c>.</para>
|
||||
///
|
||||
/// <para>Retail references:
|
||||
/// <c>docs/research/named-retail/acclient.h:32035</c> (<c>BuildInfo</c>) and
|
||||
|
|
@ -128,9 +128,14 @@ public static class BuildingLoader
|
|||
};
|
||||
reg.Add(building);
|
||||
|
||||
// NOTE: LoadedCell.BuildingId stamping is wired in RR4 (requires
|
||||
// an internal setter on LoadedCell that doesn't exist yet). This
|
||||
// comment is the placeholder called out in the plan's RR3-S11.
|
||||
// Step 4: stamp BuildingId on each cell (Option C — both directions
|
||||
// O(1)). The internal setter on LoadedCell.BuildingId is accessible
|
||||
// because this class lives in the same assembly (AcDream.App).
|
||||
foreach (var cellId in envCellIds)
|
||||
{
|
||||
if (cellsByCellId.TryGetValue(cellId, out var cell))
|
||||
cell.BuildingId = building.BuildingId;
|
||||
}
|
||||
}
|
||||
|
||||
return reg;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue