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:
@@ -80,14 +80,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return cellCenters[cell];
|
||||
}
|
||||
|
||||
int ICustomMovementLayer.EntryMovementCost(LocomotorInfo li, CPos cell)
|
||||
short ICustomMovementLayer.EntryMovementCost(LocomotorInfo li, CPos cell)
|
||||
{
|
||||
return ends.Contains(cell) ? 0 : PathGraph.CostForInvalidCell;
|
||||
return ends.Contains(cell) ? (short)0 : PathGraph.MovementCostForUnreachableCell;
|
||||
}
|
||||
|
||||
int ICustomMovementLayer.ExitMovementCost(LocomotorInfo li, CPos cell)
|
||||
short ICustomMovementLayer.ExitMovementCost(LocomotorInfo li, CPos cell)
|
||||
{
|
||||
return ends.Contains(cell) ? 0 : PathGraph.CostForInvalidCell;
|
||||
return ends.Contains(cell) ? (short)0 : PathGraph.MovementCostForUnreachableCell;
|
||||
}
|
||||
|
||||
byte ICustomMovementLayer.GetTerrainIndex(CPos cell)
|
||||
|
||||
Reference in New Issue
Block a user