Minor A* optimisations (#1335)

* Add some extra comments
* Remove the redundant closedTiles variable
* Rename some variables to better match the common naming schemes

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-07-11 04:30:33 +10:00
committed by GitHub
parent 405a610009
commit a77f219515
4 changed files with 36 additions and 55 deletions

View File

@@ -55,19 +55,11 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Pathfinding
gScores.Add(mapManager.GetGrid(tile.GridIndex).LocalToWorld(tileGrid).Position, score);
}
var closedTiles = new List<Vector2>();
foreach (var tile in routeDebug.ClosedTiles)
{
var tileGrid = mapManager.GetGrid(tile.GridIndex).GridTileToLocal(tile.GridIndices);
closedTiles.Add(mapManager.GetGrid(tile.GridIndex).LocalToWorld(tileGrid).Position);
}
var systemMessage = new SharedAiDebug.AStarRouteMessage(
routeDebug.EntityUid,
route,
cameFrom,
gScores,
closedTiles,
routeDebug.TimeTaken
);