Change indexes into tile arrays to be stored as bytes to save memory.
The index value needs only be big enough to handle all defined terrain types. This is a low number so we can save memory by defining it as a byte. This particularly saves memory for the CustomTerrain field in the Map class, which defines a cell layer for the map using tile indexes, so we can reduce the size of that layer 4x as a result.
This commit is contained in:
@@ -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] != -1)
|
||||
if (bi.GetBuildingAt(c) != self || map.CustomTerrain[c] != byte.MaxValue)
|
||||
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] != -1)
|
||||
if (bi.GetBuildingAt(c) != self || map.CustomTerrain[c] != byte.MaxValue)
|
||||
continue;
|
||||
|
||||
layer.AddTile(c, new TerrainTile(template.Id, (byte)i));
|
||||
|
||||
Reference in New Issue
Block a user