Use CellLayer for BuildingInfluence.
This commit is contained in:
@@ -19,14 +19,14 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
|
|
||||||
public class BuildingInfluence
|
public class BuildingInfluence
|
||||||
{
|
{
|
||||||
Actor[,] influence;
|
CellLayer<Actor> influence;
|
||||||
Map map;
|
Map map;
|
||||||
|
|
||||||
public BuildingInfluence(World world)
|
public BuildingInfluence(World world)
|
||||||
{
|
{
|
||||||
map = world.Map;
|
map = world.Map;
|
||||||
|
|
||||||
influence = new Actor[map.MapSize.X, map.MapSize.Y];
|
influence = new CellLayer<Actor>(map);
|
||||||
|
|
||||||
world.ActorAdded += a =>
|
world.ActorAdded += a =>
|
||||||
{
|
{
|
||||||
@@ -35,8 +35,8 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var u in FootprintUtils.Tiles(map.Rules, a.Info.Name, b.Info, a.Location))
|
foreach (var u in FootprintUtils.Tiles(map.Rules, a.Info.Name, b.Info, a.Location))
|
||||||
if (map.IsInMap(u) && influence[u.X, u.Y] == null)
|
if (map.IsInMap(u) && influence[u] == null)
|
||||||
influence[u.X, u.Y] = a;
|
influence[u] = a;
|
||||||
};
|
};
|
||||||
|
|
||||||
world.ActorRemoved += a =>
|
world.ActorRemoved += a =>
|
||||||
@@ -46,8 +46,8 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var u in FootprintUtils.Tiles(map.Rules, a.Info.Name, b.Info, a.Location))
|
foreach (var u in FootprintUtils.Tiles(map.Rules, a.Info.Name, b.Info, a.Location))
|
||||||
if (map.IsInMap(u) && influence[u.X, u.Y] == a)
|
if (map.IsInMap(u) && influence[u] == a)
|
||||||
influence[u.X, u.Y] = null;
|
influence[u] = null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
if (!map.IsInMap(cell))
|
if (!map.IsInMap(cell))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return influence[cell.X, cell.Y];
|
return influence[cell];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user