diff --git a/OpenRA.Mods.Common/Pathfinder/PathGraph.cs b/OpenRA.Mods.Common/Pathfinder/PathGraph.cs index 9530db5f49..384912b8e1 100644 --- a/OpenRA.Mods.Common/Pathfinder/PathGraph.cs +++ b/OpenRA.Mods.Common/Pathfinder/PathGraph.cs @@ -174,7 +174,7 @@ namespace OpenRA.Mods.Common.Pathfinder { var movementCost = locomotor.MovementCostToEnterCell(Actor, destNode, IgnoreActor, checkConditions); - if (movementCost != int.MaxValue && !(CustomBlock != null && CustomBlock(destNode))) + if (movementCost != short.MaxValue && !(CustomBlock != null && CustomBlock(destNode))) return CalculateCellCost(destNode, direction, movementCost); return Constants.InvalidNode; diff --git a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs index 3f938a868f..b5608a053c 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/TransformsIntoMobile.cs @@ -195,7 +195,7 @@ namespace OpenRA.Mods.Common.Traits bool CanEnterCell(Actor self, CPos cell) { - if (mobile.locomotor.MovementCostForCell(cell) == int.MaxValue) + if (mobile.locomotor.MovementCostForCell(cell) == short.MaxValue) return false; return mobile.locomotor.CanMoveFreelyInto(self, cell, null, CellConditions.BlockedByMovers); diff --git a/OpenRA.Mods.Common/Traits/Mobile.cs b/OpenRA.Mods.Common/Traits/Mobile.cs index c96901351d..e72736b52e 100644 --- a/OpenRA.Mods.Common/Traits/Mobile.cs +++ b/OpenRA.Mods.Common/Traits/Mobile.cs @@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits locomotor = world.WorldActor.TraitsImplementing() .SingleOrDefault(l => l.Info.Name == Locomotor); - if (locomotor.MovementCostForCell(cell) == int.MaxValue) + if (locomotor.MovementCostForCell(cell) == short.MaxValue) return false; var check = checkTransientActors ? CellConditions.All : CellConditions.BlockedByMovers; @@ -438,7 +438,7 @@ namespace OpenRA.Mods.Common.Traits public bool CanExistInCell(CPos cell) { - return Locomotor.MovementCostForCell(cell) != int.MaxValue; + return Locomotor.MovementCostForCell(cell) != short.MaxValue; } public bool CanEnterCell(CPos cell, Actor ignoreActor = null, bool checkTransientActors = true) @@ -876,7 +876,7 @@ namespace OpenRA.Mods.Common.Traits if (mobile.IsTraitPaused || (!explored && !locomotorInfo.MoveIntoShroud) - || (explored && mobile.Locomotor.MovementCostForCell(location) == int.MaxValue)) + || (explored && mobile.Locomotor.MovementCostForCell(location) == short.MaxValue)) cursor = mobile.Info.BlockedCursor; return true; diff --git a/OpenRA.Mods.Common/Traits/World/Locomotor.cs b/OpenRA.Mods.Common/Traits/World/Locomotor.cs index ee02cd138d..61b9f7005c 100644 --- a/OpenRA.Mods.Common/Traits/World/Locomotor.cs +++ b/OpenRA.Mods.Common/Traits/World/Locomotor.cs @@ -242,24 +242,24 @@ namespace OpenRA.Mods.Common.Traits sharesCell = info.SharesCell; } - public int MovementCostForCell(CPos cell) + public short MovementCostForCell(CPos cell) { if (!world.Map.Contains(cell)) - return int.MaxValue; + return short.MaxValue; return pathabilityCache[cell].Cost; } - public int MovementCostToEnterCell(Actor actor, CPos destNode, Actor ignoreActor, CellConditions check) + public short MovementCostToEnterCell(Actor actor, CPos destNode, Actor ignoreActor, CellConditions check) { if (!world.Map.Contains(destNode)) - return int.MaxValue; + return short.MaxValue; var cellCache = pathabilityCache[destNode]; if (cellCache.Cost == short.MaxValue || !CanMoveFreelyInto(actor, ignoreActor, destNode, check, cellCache)) - return int.MaxValue; + return short.MaxValue; return cellCache.Cost; } @@ -307,7 +307,7 @@ namespace OpenRA.Mods.Common.Traits public SubCell GetAvailableSubCell(Actor self, CPos cell, SubCell preferredSubCell = SubCell.Any, Actor ignoreActor = null, CellConditions check = CellConditions.All) { - if (MovementCostForCell(cell) == int.MaxValue) + if (MovementCostForCell(cell) == short.MaxValue) return SubCell.Invalid; if (check.HasCellCondition(CellConditions.TransientActors))