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:
RoosterDragon
2014-10-03 20:55:00 +01:00
parent 268c63f7df
commit 59b3cd154d
9 changed files with 39 additions and 36 deletions

View File

@@ -203,7 +203,7 @@ namespace OpenRA.Mods.RA
if (--c.Density < 0)
{
content[cell] = EmptyCell;
world.Map.CustomTerrain[cell] = -1;
world.Map.CustomTerrain[cell] = byte.MaxValue;
}
else
content[cell] = c;
@@ -222,7 +222,7 @@ namespace OpenRA.Mods.RA
// Clear cell
content[cell] = EmptyCell;
world.Map.CustomTerrain[cell] = -1;
world.Map.CustomTerrain[cell] = byte.MaxValue;
if (!dirty.Contains(cell))
dirty.Add(cell);