Permalink
Browse files

Flood fill now treats similar grass/snow/desert tiles as the same - f…

…ixes #4695
  • Loading branch information...
1 parent 3ed2053 commit 0052000f7bd62ab2a1c845823bd31ba108ae1244 @cjshmyr cjshmyr committed Feb 22, 2014
Showing with 5 additions and 4 deletions.
  1. +1 −0 CHANGELOG
  2. +4 −4 OpenRA.Editor/BrushTool.cs
View
@@ -57,6 +57,7 @@ NEW:
Filenames are now listed in alphabetical order
Map Editor:
Removed legacy INI/MPR map import.
+ Fixed being unable to use the flood fill tool on similar grass/snow/desert tiles.
Utility:
Added an improved INI/MPR map import.
Mod / Custom map compatibility:
@@ -88,7 +88,7 @@ void FloodFillWithBrush(Surface s, CPos pos)
while (queue.Count > 0)
{
var p = queue.Dequeue();
- if (!s.Map.MapTiles.Value[p.X, p.Y].Equals(replace))
+ if (s.Map.MapTiles.Value[p.X, p.Y].Type != replace.Type)
continue;
var a = FindEdge(s, p, new CVec(-1, 0), replace);
@@ -97,9 +97,9 @@ void FloodFillWithBrush(Surface s, CPos pos)
for (var x = a.X; x <= b.X; x++)
{
s.Map.MapTiles.Value[x, p.Y] = new TileReference<ushort, byte> { Type = brushTemplate.N, Index = (byte)0 };
- if (s.Map.MapTiles.Value[x, p.Y - 1].Equals(replace))
+ if (s.Map.MapTiles.Value[x, p.Y - 1].Type == replace.Type)
maybeEnqueue(x, p.Y - 1);
- if (s.Map.MapTiles.Value[x, p.Y + 1].Equals(replace))
+ if (s.Map.MapTiles.Value[x, p.Y + 1].Type == replace.Type)
maybeEnqueue(x, p.Y + 1);
}
}
@@ -115,7 +115,7 @@ CPos FindEdge(Surface s, CPos p, CVec d, TileReference<ushort, byte> replace)
{
var q = p + d;
if (!s.Map.IsInMap(q)) return p;
- if (!s.Map.MapTiles.Value[q.X, q.Y].Equals(replace)) return p;
+ if (s.Map.MapTiles.Value[q.X, q.Y].Type != replace.Type) return p;
p = q;
}
}

0 comments on commit 0052000

Please sign in to comment.