Save Mobile look-up in BasePathSearch

By casting to OccupiesSpace and then
looking up Info.LocomotorInfo directly.
This commit is contained in:
reaperrr
2020-05-30 09:48:32 +02:00
committed by Matthias Mailänder
parent 4bf614c5cd
commit 55e85bd9ca

View File

@@ -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<Mobile>().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;
}