Use CellLayer for custom terrain.
This commit is contained in:
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
// Set the initial custom terrain types
|
||||
foreach (var c in footprint.Keys)
|
||||
self.World.Map.CustomTerrain[c.X, c.Y] = GetTerrainType(c);
|
||||
self.World.Map.CustomTerrain[c] = GetTerrainType(c);
|
||||
}
|
||||
|
||||
int GetTerrainType(CPos cell)
|
||||
@@ -204,7 +204,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
// Update map
|
||||
foreach (var c in footprint.Keys)
|
||||
self.World.Map.CustomTerrain[c.X, c.Y] = GetTerrainType(c);
|
||||
self.World.Map.CustomTerrain[c] = GetTerrainType(c);
|
||||
|
||||
// If this bridge repair operation connects two pathfinding domains,
|
||||
// update the domain index.
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.RA.Buildings
|
||||
continue;
|
||||
|
||||
// Don't place under other buildings or custom terrain
|
||||
if (bi.GetBuildingAt(c) != self || map.CustomTerrain[c.X, c.Y] != -1)
|
||||
if (bi.GetBuildingAt(c) != self || map.CustomTerrain[c] != -1)
|
||||
continue;
|
||||
|
||||
var index = Game.CosmeticRandom.Next(template.TilesCount);
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.RA.Buildings
|
||||
continue;
|
||||
|
||||
// Don't place under other buildings or custom terrain
|
||||
if (bi.GetBuildingAt(c) != self || map.CustomTerrain[c.X, c.Y] != -1)
|
||||
if (bi.GetBuildingAt(c) != self || map.CustomTerrain[c] != -1)
|
||||
continue;
|
||||
|
||||
layer.AddTile(c, new TileReference<ushort, byte>(template.Id, (byte)i));
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public void AddTile(CPos cell, TileReference<ushort, byte> tile)
|
||||
{
|
||||
map.CustomTerrain[cell.X, cell.Y] = tileset.GetTerrainIndex(tile);
|
||||
map.CustomTerrain[cell] = tileset.GetTerrainIndex(tile);
|
||||
|
||||
// Terrain tiles define their origin at the topleft
|
||||
var s = theater.TileSprite(tile);
|
||||
|
||||
Reference in New Issue
Block a user