automatically fix open areas

and don't hard-code the tiles no more
This commit is contained in:
Matthias Mailänder
2014-01-03 16:46:38 +01:00
parent 9cea5f96cd
commit c6d9574d52
11 changed files with 215 additions and 19 deletions

View File

@@ -402,6 +402,7 @@ namespace OpenRA.Editor
map.Players.Clear();
map.MakeDefaultPlayers();
map.FixOpenAreas();
NewMap(map);
}
@@ -484,18 +485,7 @@ namespace OpenRA.Editor
void FixOpenAreas(object sender, EventArgs e)
{
dirty = true;
var r = new Random();
for (var j = surface1.Map.Bounds.Top; j < surface1.Map.Bounds.Bottom; j++)
for (var i = surface1.Map.Bounds.Left; i < surface1.Map.Bounds.Right; i++)
{
var tr = surface1.Map.MapTiles.Value[i, j];
if (tr.Type == 0xff || tr.Type == 0xffff || tr.Type == 1 || tr.Type == 2)
tr.Index = (byte)r.Next(0, surface1.TileSetRenderer.Data(tr.Type).Count);
surface1.Map.MapTiles.Value[i, j] = tr;
}
surface1.Map.FixOpenAreas();
surface1.Chunks.Clear();
surface1.Invalidate();
}