Refactored [sub-]cell availability logic in IPositionable & ActorMap

Moved the logic from IPositionable.CanEnterCell & integrated sub-cell selection.
Added IPositionable.IsMovingFrom(CPos location, int subCell = -1) - to detect transient actors
Renamed IPositionable.{GetDesiredSubcell => GetAvailableSubcell} - since it checks for available sub-cells
Reduced IPositionable.CanEnterCell to one method that usually uses IPositionable.GetAvailableSubcell
Added actor checking to ActorMap.{HasFreeSubCell, FreeSubCell, AnyUnitsAt} - used by [sub-]cell availability logic
This commit is contained in:
atlimit8
2014-08-10 19:43:45 -05:00
parent ff7ad53dee
commit b2c9064545
8 changed files with 117 additions and 64 deletions

View File

@@ -245,7 +245,7 @@ namespace OpenRA.Mods.RA.Move
hasWaited = false;
path.RemoveAt(path.Count - 1);
var subCell = mobile.GetDesiredSubcell(nextCell, ignoreBuilding);
var subCell = mobile.GetAvailableSubcell(nextCell, -1, ignoreBuilding);
return Pair.New(nextCell, subCell);
}