Use Map.IsInMap(CPos) for things that are checking CPos.
This commit is contained in:
@@ -75,9 +75,10 @@ namespace OpenRA.Editor
|
|||||||
|
|
||||||
Action<int, int> maybeEnqueue = (x, y) =>
|
Action<int, int> maybeEnqueue = (x, y) =>
|
||||||
{
|
{
|
||||||
if (s.Map.IsInMap(x, y) && !touched[x, y])
|
var c = new CPos(x, y);
|
||||||
|
if (s.Map.IsInMap(c) && !touched[x, y])
|
||||||
{
|
{
|
||||||
queue.Enqueue(new CPos(x, y));
|
queue.Enqueue(c);
|
||||||
touched[x, y] = true;
|
touched[x, y] = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
|
|
||||||
var res = world.WorldActor.Trait<ResourceLayer>();
|
var res = world.WorldActor.Trait<ResourceLayer>();
|
||||||
return FootprintUtils.Tiles(world.Map.Rules, name, building, topLeft).All(
|
return FootprintUtils.Tiles(world.Map.Rules, name, building, topLeft).All(
|
||||||
t => world.Map.IsInMap(t.X, t.Y) && res.GetResource(t) == null &&
|
t => world.Map.IsInMap(t) && res.GetResource(t) == null &&
|
||||||
world.IsCellBuildable(t, building, toIgnore));
|
world.IsCellBuildable(t, building, toIgnore));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
public bool CanEnterCell(CPos cell, Actor ignoreActor, bool checkTransientActors)
|
public bool CanEnterCell(CPos cell, Actor ignoreActor, bool checkTransientActors)
|
||||||
{
|
{
|
||||||
if (!self.World.Map.IsInMap(cell.X, cell.Y)) return false;
|
if (!self.World.Map.IsInMap(cell)) return false;
|
||||||
|
|
||||||
var type = self.World.Map.GetTerrainInfo(cell).Type;
|
var type = self.World.Map.GetTerrainInfo(cell).Type;
|
||||||
if (!info.TerrainTypes.Contains(type))
|
if (!info.TerrainTypes.Contains(type))
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public IEnumerable<Pair<CPos, SubCell>> OccupiedCells() { yield return Pair.New(TopLeft, SubCell.FullCell); }
|
public IEnumerable<Pair<CPos, SubCell>> OccupiedCells() { yield return Pair.New(TopLeft, SubCell.FullCell); }
|
||||||
public bool CanEnterCell(CPos cell, Actor ignoreActor, bool checkTransientActors)
|
public bool CanEnterCell(CPos cell, Actor ignoreActor, bool checkTransientActors)
|
||||||
{
|
{
|
||||||
if (!self.World.Map.IsInMap(cell.X, cell.Y))
|
if (!self.World.Map.IsInMap(cell))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!info.AllowedTerrain.Contains(self.World.Map.GetTerrainInfo(cell).Type))
|
if (!info.AllowedTerrain.Contains(self.World.Map.GetTerrainInfo(cell).Type))
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
|
|
||||||
public int MovementCostForCell(World world, CPos cell)
|
public int MovementCostForCell(World world, CPos cell)
|
||||||
{
|
{
|
||||||
if (!world.Map.IsInMap(cell.X, cell.Y))
|
if (!world.Map.IsInMap(cell))
|
||||||
return int.MaxValue;
|
return int.MaxValue;
|
||||||
|
|
||||||
var index = world.Map.GetTerrainIndex(cell);
|
var index = world.Map.GetTerrainIndex(cell);
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
var newHere = p.Location + d;
|
var newHere = p.Location + d;
|
||||||
|
|
||||||
// Is this direction flat-out unusable or already seen?
|
// Is this direction flat-out unusable or already seen?
|
||||||
if (!world.Map.IsInMap(newHere.X, newHere.Y))
|
if (!world.Map.IsInMap(newHere))
|
||||||
continue;
|
continue;
|
||||||
if (cellInfo[newHere.X, newHere.Y].Seen)
|
if (cellInfo[newHere.X, newHere.Y].Seen)
|
||||||
continue;
|
continue;
|
||||||
@@ -191,7 +191,7 @@ namespace OpenRA.Mods.RA.Move
|
|||||||
|
|
||||||
public void AddInitialCell(CPos location)
|
public void AddInitialCell(CPos location)
|
||||||
{
|
{
|
||||||
if (!world.Map.IsInMap(location.X, location.Y))
|
if (!world.Map.IsInMap(location))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cellInfo[location.X, location.Y] = new CellInfo(0, location, false);
|
cellInfo[location.X, location.Y] = new CellInfo(0, location, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user