From 4be20e7aacbd66bf50fcb3afb7890419ebcd0d89 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 30 Jan 2011 14:11:14 +1300 Subject: [PATCH] move waypoint namer into WaypointTool --- OpenRA.Editor/Surface.cs | 11 ----------- OpenRA.Editor/WaypointTool.cs | 13 ++++++++++++- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/OpenRA.Editor/Surface.cs b/OpenRA.Editor/Surface.cs index 703138c1d6..52a1df208f 100755 --- a/OpenRA.Editor/Surface.cs +++ b/OpenRA.Editor/Surface.cs @@ -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 diff --git a/OpenRA.Editor/WaypointTool.cs b/OpenRA.Editor/WaypointTool.cs index 8e5b554b88..97b948ddd3 100644 --- a/OpenRA.Editor/WaypointTool.cs +++ b/OpenRA.Editor/WaypointTool.cs @@ -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; + } + } } }