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 // 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. // 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 dirt = new GridPathfindingChunk[comp.DirtyChunks.Count];
var i = 0; var idx = 0;
foreach (var origin in comp.DirtyChunks) foreach (var origin in comp.DirtyChunks)
{ {
var chunk = GetChunk(origin, comp.Owner, comp); var chunk = GetChunk(origin, comp.Owner, comp);
dirt[i] = chunk; dirt[idx] = chunk;
i++; idx++;
} }
// We force clear portals in a single-threaded context to be safe // 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 // This is for map <> grid pathfinding
// Without parallel this is roughly 3x slower on my desktop. // 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. // Doing the queries per task seems faster.
var accessQuery = GetEntityQuery<AccessReaderComponent>(); var accessQuery = GetEntityQuery<AccessReaderComponent>();
@@ -129,7 +129,7 @@ public sealed partial class PathfindingSystem
var physicsQuery = GetEntityQuery<PhysicsComponent>(); var physicsQuery = GetEntityQuery<PhysicsComponent>();
var xformQuery = GetEntityQuery<TransformComponent>(); var xformQuery = GetEntityQuery<TransformComponent>();
BuildBreadcrumbs(dirt[i], mapGridComp.Grid, accessQuery, destructibleQuery, doorQuery, fixturesQuery, physicsQuery, xformQuery); BuildBreadcrumbs(dirt[i], mapGridComp.Grid, accessQuery, destructibleQuery, doorQuery, fixturesQuery, physicsQuery, xformQuery);
}); }
const int Division = 4; const int Division = 4;