move waypoint namer into WaypointTool
This commit is contained in:
@@ -139,17 +139,6 @@ namespace OpenRA.Editor
|
||||
}
|
||||
}
|
||||
|
||||
int wpid;
|
||||
public string NextWpid()
|
||||
{
|
||||
for (; ; )
|
||||
{
|
||||
var a = "wp{0}".F(wpid++);
|
||||
if (!Map.Waypoints.ContainsKey(a))
|
||||
return a;
|
||||
}
|
||||
}
|
||||
|
||||
void Erase()
|
||||
{
|
||||
// Crash preventing
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Editor
|
||||
var k = surface.Map.Waypoints.FirstOrDefault(a => a.Value == surface.GetBrushLocation());
|
||||
if (k.Key != null) surface.Map.Waypoints.Remove(k.Key);
|
||||
|
||||
surface.Map.Waypoints.Add(surface.NextWpid(), surface.GetBrushLocation());
|
||||
surface.Map.Waypoints.Add(NextWpid(surface), surface.GetBrushLocation());
|
||||
}
|
||||
|
||||
public void Preview(Surface surface, SGraphics g)
|
||||
@@ -36,5 +36,16 @@ namespace OpenRA.Editor
|
||||
surface.TileSet.TileSize * surface.GetBrushLocation().Y * surface.Zoom + surface.GetOffset().Y + 4,
|
||||
(surface.TileSet.TileSize - 8) * surface.Zoom, (surface.TileSet.TileSize - 8) * surface.Zoom);
|
||||
}
|
||||
|
||||
public string NextWpid(Surface surface)
|
||||
{
|
||||
int wpid = 0;
|
||||
for (; ; )
|
||||
{
|
||||
var a = "wp{0}".F(wpid++);
|
||||
if (!surface.Map.Waypoints.ContainsKey(a))
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user