Bandaid pathpoly neighbors for now (#12337)

This commit is contained in:
metalgearsloth
2022-11-01 23:39:58 +11:00
committed by GitHub
parent 4d51f786c6
commit 508b810137

View File

@@ -89,13 +89,13 @@ public sealed partial class PathfindingSystem
// TODO: Often we invalidate the entire chunk when it might be something as simple as an airlock change
// Would be better to handle that though this was safer and max it's taking is like 1-2ms every half-second.
var dirt = new GridPathfindingChunk[comp.DirtyChunks.Count];
var i = 0;
var idx = 0;
foreach (var origin in comp.DirtyChunks)
{
var chunk = GetChunk(origin, comp.Owner, comp);
dirt[i] = chunk;
i++;
dirt[idx] = chunk;
idx++;
}
// We force clear portals in a single-threaded context to be safe
@@ -119,7 +119,7 @@ public sealed partial class PathfindingSystem
// This is for map <> grid pathfinding
// Without parallel this is roughly 3x slower on my desktop.
Parallel.For(0, dirt.Length, i =>
for (var i = 0; i < dirt.Length; i++)
{
// Doing the queries per task seems faster.
var accessQuery = GetEntityQuery<AccessReaderComponent>();
@@ -129,7 +129,7 @@ public sealed partial class PathfindingSystem
var physicsQuery = GetEntityQuery<PhysicsComponent>();
var xformQuery = GetEntityQuery<TransformComponent>();
BuildBreadcrumbs(dirt[i], mapGridComp.Grid, accessQuery, destructibleQuery, doorQuery, fixturesQuery, physicsQuery, xformQuery);
});
}
const int Division = 4;