Change impassable terrain to short.max
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
locomotor = world.WorldActor.TraitsImplementing<Locomotor>()
|
||||
.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;
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user