fix(core): UCG Stage 1 — final-review polish (VisibleCells null-guard, Neighbor doc)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8e703bef22
commit
f2663b7e4b
2 changed files with 8 additions and 2 deletions
|
|
@ -49,5 +49,10 @@ public sealed class CellGraph
|
||||||
return LandCell.Synthesize(id, t.Terrain, t.Origin, idx / 8, idx % 8);
|
return LandCell.Synthesize(id, t.Terrain, t.Origin, idx / 8, idx % 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resolve the cell on the far side of a portal — retail CCellPortal::GetOtherCell =
|
||||||
|
/// GetVisible(other_cell_id). <paramref name="cell"/> documents the traversal source and is
|
||||||
|
/// reserved for the OtherCellPtr neighbor cache (Stage 3); the lookup keys only on the portal.
|
||||||
|
/// </summary>
|
||||||
public ObjCell? Neighbor(ObjCell cell, in CellPortal portal) => GetVisible(portal.OtherCellId);
|
public ObjCell? Neighbor(ObjCell cell, in CellPortal portal) => GetVisible(portal.OtherCellId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,9 @@ public sealed class EnvCell : ObjCell
|
||||||
}
|
}
|
||||||
|
|
||||||
uint lbPrefix = id & 0xFFFF0000u;
|
uint lbPrefix = id & 0xFFFF0000u;
|
||||||
var stab = new List<uint>(datCell.VisibleCells.Count);
|
var stab = new List<uint>();
|
||||||
foreach (var low in datCell.VisibleCells) stab.Add(lbPrefix | low);
|
if (datCell.VisibleCells is not null) // match BuildLoadedCell:5701 null guard
|
||||||
|
foreach (var low in datCell.VisibleCells) stab.Add(lbPrefix | low);
|
||||||
bool seenOutside = datCell.Flags.HasFlag(EnvCellFlags.SeenOutside);
|
bool seenOutside = datCell.Flags.HasFlag(EnvCellFlags.SeenOutside);
|
||||||
|
|
||||||
return new EnvCell(id, worldTransform, inverse, min, max, portals, stab,
|
return new EnvCell(id, worldTransform, inverse, min, max, portals, stab,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue