fix(physics): validate retail cell containment roots

This commit is contained in:
Erik 2026-07-31 14:48:26 +02:00
parent 7716c2ee89
commit 3e0f3b6206
23 changed files with 429 additions and 197 deletions

View file

@ -8,11 +8,11 @@ namespace AcDream.Core.Tests.Physics;
public class CellTransitCheckBuildingTransitTests
{
[Fact]
public void BuildingPortalWithLoadedNullRoot_CellIsAdmitted()
public void BuildingPortalWithRootlessContainment_CellIsRejected()
{
// Retail separates an unavailable CEnvCell lookup from an authored
// CellStruct whose cell_bsp root is null. The latter is loaded, and
// the null-root sphere query is the universal-inside base case.
// Retail dereferences CCellStruct.cell_bsp->root_node before calling
// the recursive query. A missing positive child means inside; a
// missing root is not a valid loaded CEnvCell.
// Building at world origin. One portal to interior cell 0xA9B40100.
var building = new BuildingPhysics
@ -28,7 +28,8 @@ public class CellTransitCheckBuildingTransitTests
},
};
// Interior cell with an authored null containment root.
// Rootless fixture bypasses the production quarantine to verify that
// the traversal boundary still rejects it safely.
var interiorCell = new CellPhysics
{
WorldTransform = Matrix4x4.Identity,
@ -47,7 +48,7 @@ public class CellTransitCheckBuildingTransitTests
sphereRadius: 0.5f,
candidates);
Assert.Contains(0xA9B40100u, candidates);
Assert.Empty(candidates);
}
[Fact]