From 508b81013748aed4d3c5443c3da01a7713c35baa Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Tue, 1 Nov 2022 23:39:58 +1100 Subject: [PATCH] Bandaid pathpoly neighbors for now (#12337) --- .../NPC/Pathfinding/PathfindingSystem.Grid.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs b/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs index c5b3d1b3da..58f45916d3 100644 --- a/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs +++ b/Content.Server/NPC/Pathfinding/PathfindingSystem.Grid.cs @@ -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(); @@ -129,7 +129,7 @@ public sealed partial class PathfindingSystem var physicsQuery = GetEntityQuery(); var xformQuery = GetEntityQuery(); BuildBreadcrumbs(dirt[i], mapGridComp.Grid, accessQuery, destructibleQuery, doorQuery, fixturesQuery, physicsQuery, xformQuery); - }); + } const int Division = 4;