using System.Collections.Generic; using System.Numerics; using AcDream.Core.Physics; using AcDream.Core.World.Cells; using DatReaderWriter.Types; using Xunit; using DatEnvCell = DatReaderWriter.DBObjs.EnvCell; namespace AcDream.Core.Tests.Physics; public class CellGraphPopulationTests { [Fact] public void CacheCellStruct_AddsEnvCellToGraph_EvenWhenPhysicsBspIsNull() { var cache = new PhysicsDataCache(); var cellStruct = new CellStruct { VertexArray = new VertexArray { Vertices = new Dictionary() }, Polygons = new Dictionary(), // PhysicsBSP omitted (defaults to null) — triggers the null-BSP drop from _cellStruct }; var dat = new DatEnvCell { Flags = (DatReaderWriter.Enums.EnvCellFlags)0, CellPortals = new List(), VisibleCells = new List(), }; cache.CacheCellStruct(0xA9B40174u, dat, cellStruct, Matrix4x4.Identity); Assert.Null(cache.GetCellStruct(0xA9B40174u)); // dropped from physics cache Assert.NotNull(cache.CellGraph.GetVisible(0xA9B40174u)); // but present in the graph Assert.IsType(cache.CellGraph.GetVisible(0xA9B40174u)); } }