refactor: Add BitMask256 utility for 256-bit bitmask operations (#2300)
### Summary - Create BitMask256 struct with scalar operations (benchmarks showed AVX2 vectorization provides no benefit for this size) - Refactor Map.cs to use BitMask256 for full Z range support (-128 to 127) - Remove SectorSpawnCache struct, use BitMask256 directly in manager - Update tests to use BitMask256 directly - Remove unused test assertions for old 64-bit behavior
This commit is contained in:
parent
d3b43f6f0e
commit
598223703f
7 changed files with 482 additions and 261 deletions
|
|
@ -21,8 +21,6 @@ public class CanFitItemTests
|
|||
Skip.If(!ServerFixture.TileDataLoaded, "TileData not loaded - client files required");
|
||||
}
|
||||
|
||||
#region Basic Validation Tests
|
||||
|
||||
[Fact]
|
||||
public void CanFitItem_InternalMapReturnsFalse()
|
||||
{
|
||||
|
|
@ -42,10 +40,6 @@ public class CanFitItemTests
|
|||
Assert.False(map.CanFitItem(100, map.Height + 1, 0, 1));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Land Surface Tests
|
||||
|
||||
private const int TestLandX = 1500;
|
||||
private const int TestLandY = 1600;
|
||||
|
||||
|
|
@ -72,10 +66,6 @@ public class CanFitItemTests
|
|||
Assert.False(result, "No surface 50 units above land");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Surface + Impassable Tests (Tables, Furniture)
|
||||
|
||||
[SkippableFact]
|
||||
public void CanFitItem_SurfaceImpassableMultiIsValidSurface()
|
||||
{
|
||||
|
|
@ -145,10 +135,6 @@ public class CanFitItemTests
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region World Item Surface Tests
|
||||
|
||||
[SkippableFact]
|
||||
public void CanFitItem_NonMovableWorldItemSurfaceWorks()
|
||||
{
|
||||
|
|
@ -215,10 +201,6 @@ public class CanFitItemTests
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Blocking Tests
|
||||
|
||||
[SkippableFact]
|
||||
public void CanFitItem_ImpassableTileBlocksPlacement()
|
||||
{
|
||||
|
|
@ -278,10 +260,6 @@ public class CanFitItemTests
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper Methods and Classes
|
||||
|
||||
private TestMulti CreateSurfaceImpassableMulti(Map map, Point3D location, int surfaceZ)
|
||||
{
|
||||
// Use SurfaceImpassableTileId - a tile that has both Surface and Impassable flags
|
||||
|
|
@ -322,6 +300,4 @@ public class CanFitItemTests
|
|||
|
||||
public override MultiComponentList Components => _components;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ namespace Server.Tests.Tests.Maps;
|
|||
[Collection("Sequential Server Tests")]
|
||||
public class CanSpawnMobileTests
|
||||
{
|
||||
#region Basic Validation Tests
|
||||
|
||||
[Fact]
|
||||
public void CanSpawnMobile_InternalMapReturnsFalse()
|
||||
{
|
||||
|
|
@ -31,10 +29,6 @@ public class CanSpawnMobileTests
|
|||
Assert.False(map.CanSpawnMobile(100, map.Height + 1, -128, 127, false, false, out _));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Land Surface Tests
|
||||
|
||||
// Use coordinates near Britain which should be walkable land in both test and real data
|
||||
private const int TestLandX = 1500;
|
||||
private const int TestLandY = 1600;
|
||||
|
|
@ -74,10 +68,6 @@ public class CanSpawnMobileTests
|
|||
Assert.False(result, "cantWalk=true should not find land as valid surface");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mobile Blocking Tests
|
||||
|
||||
[Fact]
|
||||
public void CanSpawnMobile_MobileBlocksSpawn()
|
||||
{
|
||||
|
|
@ -162,10 +152,6 @@ public class CanSpawnMobileTests
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper Classes
|
||||
|
||||
private class TestMobile : Mobile
|
||||
{
|
||||
public TestMobile()
|
||||
|
|
@ -174,6 +160,4 @@ public class CanSpawnMobileTests
|
|||
Hidden = false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ public class CanSpawnMobileTileDataTests
|
|||
Skip.If(!ServerFixture.TileDataLoaded, "TileData not loaded - client files required");
|
||||
}
|
||||
|
||||
#region Multi-Based Tests
|
||||
|
||||
[SkippableFact]
|
||||
public void CanSpawnMobile_FindsSurfaceOnMulti()
|
||||
{
|
||||
|
|
@ -241,10 +239,6 @@ public class CanSpawnMobileTileDataTests
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Real Map Data Tests
|
||||
|
||||
[SkippableFact]
|
||||
public void CanSpawnMobile_MalasBuilding_FindsGroundFloor()
|
||||
{
|
||||
|
|
@ -290,10 +284,6 @@ public class CanSpawnMobileTileDataTests
|
|||
Assert.True(spawnZ <= -40, $"Expected lowest floor around -50, got {spawnZ}");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper Methods and Classes
|
||||
|
||||
private TestMulti CreateFloorMulti(Map map, Point3D location, int floorZ)
|
||||
{
|
||||
var multi = new TestMulti(CreateFloorComponents(floorZ));
|
||||
|
|
@ -367,6 +357,4 @@ public class CanSpawnMobileTileDataTests
|
|||
|
||||
public override MultiComponentList Components => _components;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue