move waypoint namer into WaypointTool

This commit is contained in:
Chris Forbes
2011-01-30 14:11:14 +13:00
parent 40f88e5c47
commit 4be20e7aac
2 changed files with 12 additions and 12 deletions

View File

@@ -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() void Erase()
{ {
// Crash preventing // Crash preventing

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Editor
var k = surface.Map.Waypoints.FirstOrDefault(a => a.Value == surface.GetBrushLocation()); var k = surface.Map.Waypoints.FirstOrDefault(a => a.Value == surface.GetBrushLocation());
if (k.Key != null) surface.Map.Waypoints.Remove(k.Key); 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) 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 * surface.GetBrushLocation().Y * surface.Zoom + surface.GetOffset().Y + 4,
(surface.TileSet.TileSize - 8) * surface.Zoom, (surface.TileSet.TileSize - 8) * surface.Zoom); (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;
}
}
} }
} }