Skip to content

Commit fded482

Browse files
committed
Fix bug where waypoint placement window was hidden even when placing the waypoint failed
1 parent a17ce91 commit fded482

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/TSMapEditor/UI/Windows/PlaceWaypointWindow.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ private void BtnPlace_LeftClick(object sender, EventArgs e)
5959

6060
int waypointNumber = tbWaypointNumber.Value;
6161

62-
PlaceWaypoint(waypointNumber, cellCoords);
63-
Hide();
62+
if (PlaceWaypoint(waypointNumber, cellCoords))
63+
Hide();
6464
}
6565

66-
public void PlaceWaypoint(int waypointNumber, Point2D cellCoords)
66+
public bool PlaceWaypoint(int waypointNumber, Point2D cellCoords)
6767
{
6868
if (waypointNumber < 0 || waypointNumber >= Constants.MaxWaypoint)
69-
return;
69+
return false;
7070

7171
if (map.Waypoints.Exists(w => w.Identifier == waypointNumber))
7272
{
@@ -76,12 +76,13 @@ public void PlaceWaypoint(int waypointNumber, Point2D cellCoords)
7676
"A waypoint with the given number {0} already exists on the map!"), waypointNumber),
7777
MessageBoxButtons.OK);
7878

79-
return;
79+
return false;
8080
}
8181

8282
string waypointColor = ddWaypointColor.SelectedItem != null ? ddWaypointColor.SelectedItem.Text : null;
8383

8484
mutationManager.PerformMutation(new PlaceWaypointMutation(mutationTarget, cellCoords, waypointNumber, waypointColor));
85+
return true;
8586
}
8687

8788
public void Open(Point2D cellCoords)

0 commit comments

Comments
 (0)