Add a subCell parameter to IPositionableInfo.CanEnterCell

This commit is contained in:
abcdefg30
2019-10-12 12:07:02 +02:00
committed by teinarss
parent 980c1e1b6a
commit 4717e98c48
8 changed files with 19 additions and 14 deletions

View File

@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Traits
// initialized and used by CanEnterCell
Locomotor locomotor;
public bool CanEnterCell(World world, Actor self, CPos cell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
public bool CanEnterCell(World world, Actor self, CPos cell, SubCell subCell = SubCell.FullCell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
{
// PERF: Avoid repeated trait queries on the hot path
if (locomotor == null)
@@ -96,7 +96,7 @@ namespace OpenRA.Mods.Common.Traits
if (locomotor.MovementCostForCell(cell) == short.MaxValue)
return false;
return locomotor.CanMoveFreelyInto(self, cell, check, ignoreActor);
return locomotor.CanMoveFreelyInto(self, cell, subCell, check, ignoreActor);
}
public IReadOnlyDictionary<CPos, SubCell> OccupiedCells(ActorInfo info, CPos location, SubCell subCell = SubCell.Any)
@@ -501,7 +501,7 @@ namespace OpenRA.Mods.Common.Traits
public bool CanEnterCell(CPos cell, Actor ignoreActor = null, BlockedByActor check = BlockedByActor.All)
{
return Info.CanEnterCell(self.World, self, cell, ignoreActor, check);
return Info.CanEnterCell(self.World, self, cell, SubCell.FullCell, ignoreActor, check);
}
#endregion