From 55e85bd9ca543d403bdc18ee4317b64e607c6729 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 30 May 2020 09:48:32 +0200 Subject: [PATCH] Save Mobile look-up in BasePathSearch By casting to OccupiesSpace and then looking up Info.LocomotorInfo directly. --- OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs b/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs index 95914e7b6c..1b0c9fb817 100644 --- a/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs +++ b/OpenRA.Mods.Common/Pathfinder/BasePathSearch.cs @@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Pathfinder // Determine the minimum possible cost for moving horizontally between cells based on terrain speeds. // The minimum possible cost diagonally is then Sqrt(2) times more costly. - cellCost = graph.Actor.Trait().Locomotor.Info.TerrainSpeeds.Values.Min(ti => ti.Cost); + cellCost = ((Mobile)graph.Actor.OccupiesSpace).Info.LocomotorInfo.TerrainSpeeds.Values.Min(ti => ti.Cost); diagonalCellCost = cellCost * 141421 / 100000; }