Use named pathfinding constants.
- Rename CostForInvalidCell to PathCostForInvalidPath - Add MovementCostForUnreachableCell - Update usages of int.MaxValue and short.Maxvalue to use named constants where relevant. - Update costs on ICustomMovementLayer to return short, for consistency with costs from Locomotor. - Rename some methods to distinguish between path/movement cost.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Activities;
|
||||
using OpenRA.Mods.Common.Pathfinder;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -210,7 +211,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
bool CanEnterCell(Actor self, CPos cell)
|
||||
{
|
||||
if (mobile.locomotor.MovementCostForCell(cell) == short.MaxValue)
|
||||
if (mobile.locomotor.MovementCostForCell(cell) == PathGraph.MovementCostForUnreachableCell)
|
||||
return false;
|
||||
|
||||
return mobile.locomotor.CanMoveFreelyInto(self, cell, BlockedByActor.All, null);
|
||||
|
||||
Reference in New Issue
Block a user