refactor(physics): Stage 1 — widen cell-candidate helpers to ICollection<uint>

Non-behavioral: lets BuildCellSetAndPickContaining pass an ordered CellArray (next
commit) while existing HashSet-passing test callers compile unchanged. HashSet<uint>
and CellArray both implement ICollection<uint>. Core builds; 9 helper tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-03 08:56:07 +02:00
parent b44dd147bc
commit bc56545634

View file

@ -49,7 +49,7 @@ public static class CellTransit
uint currentCellId,
Vector3 worldSphereCenter,
float sphereRadius,
HashSet<uint> candidates,
ICollection<uint> candidates,
out bool exitOutside)
{
var spheres = new[]
@ -77,7 +77,7 @@ public static class CellTransit
uint currentCellId,
IReadOnlyList<Sphere> worldSpheres,
int numSpheres,
HashSet<uint> candidates,
ICollection<uint> candidates,
out bool exitOutside)
{
exitOutside = false;
@ -213,7 +213,7 @@ public static class CellTransit
Vector3 worldSphereCenter,
float sphereRadius,
uint currentCellId,
HashSet<uint> candidates)
ICollection<uint> candidates)
{
const float CellSize = 24f;
@ -257,7 +257,7 @@ public static class CellTransit
IReadOnlyList<Sphere> worldSpheres,
int numSpheres,
uint currentCellId,
HashSet<uint> candidates)
ICollection<uint> candidates)
{
int sphereCount = EffectiveSphereCount(worldSpheres, numSpheres);
for (int i = 0; i < sphereCount; i++)
@ -267,7 +267,7 @@ public static class CellTransit
}
}
private static void AddOutsideCell(HashSet<uint> candidates, uint lbPrefix, int gridX, int gridY)
private static void AddOutsideCell(ICollection<uint> candidates, uint lbPrefix, int gridX, int gridY)
{
if (gridX < 0 || gridX >= 8 || gridY < 0 || gridY >= 8) return;
@ -301,7 +301,7 @@ public static class CellTransit
BuildingPhysics building,
Vector3 worldSphereCenter,
float sphereRadius,
HashSet<uint> candidates)
ICollection<uint> candidates)
{
foreach (var portal in building.Portals)
{