Reference SubCells directly from MapGrid.
This commit is contained in:
@@ -368,7 +368,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
speedModifiers = Exts.Lazy(() => self.TraitsImplementing<ISpeedModifier>().ToArray().Select(x => x.GetSpeedModifier()));
|
||||
|
||||
ToSubCell = FromSubCell = info.SharesCell ? init.World.Map.DefaultSubCell : SubCell.FullCell;
|
||||
ToSubCell = FromSubCell = info.SharesCell ? init.World.Map.Grid.DefaultSubCell : SubCell.FullCell;
|
||||
if (init.Contains<SubCellInit>())
|
||||
FromSubCell = ToSubCell = init.Get<SubCellInit, SubCell>();
|
||||
|
||||
@@ -397,7 +397,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (Info.SharesCell)
|
||||
{
|
||||
if (preferred <= SubCell.FullCell)
|
||||
return self.World.Map.DefaultSubCell;
|
||||
return self.World.Map.Grid.DefaultSubCell;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -776,7 +776,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// TODO: solve/reduce cell is full problem
|
||||
if (subCell == SubCell.Invalid)
|
||||
subCell = self.World.Map.DefaultSubCell;
|
||||
subCell = self.World.Map.Grid.DefaultSubCell;
|
||||
|
||||
// Reserve the exit cell
|
||||
SetPosition(self, cell, subCell);
|
||||
|
||||
@@ -226,9 +226,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var map = worldRenderer.World.Map;
|
||||
var previews = PreviewsAt(cell).ToList();
|
||||
if (!previews.Any())
|
||||
return map.DefaultSubCell;
|
||||
return map.Grid.DefaultSubCell;
|
||||
|
||||
for (var i = (int)SubCell.First; i < map.SubCellOffsets.Length; i++)
|
||||
for (var i = (int)SubCell.First; i < map.Grid.SubCellOffsets.Length; i++)
|
||||
if (!previews.Any(p => p.Footprint[cell] == (SubCell)i))
|
||||
return (SubCell)i;
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var targetCell = world.Map.CellContaining(target);
|
||||
|
||||
// Correct for SubCell offset
|
||||
target -= world.Map.OffsetOfSubCell(srcSub);
|
||||
target -= world.Map.Grid.OffsetOfSubCell(srcSub);
|
||||
|
||||
// Select only the tiles that are within range from the requested SubCell
|
||||
// This assumes that the SubCell does not change during the path traversal
|
||||
|
||||
Reference in New Issue
Block a user