From f98f5fd291d83df5d712adaa1901a3dff12adbfe Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 30 Jun 2022 21:53:36 +0100 Subject: [PATCH] Fix not being able to build waypoints when custom types no longer present And a custom type was previously selected --- src/rail_gui.cpp | 8 ++++++-- src/road_gui.cpp | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index f718ef8ffb..730f2664e3 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -684,8 +684,12 @@ struct BuildRailToolbarWindow : Window { case WID_RAT_BUILD_WAYPOINT: this->last_user_action = widget; _waypoint_count = StationClass::Get(STAT_CLASS_WAYP)->GetSpecCount(); - if (HandlePlacePushButton(this, WID_RAT_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, HT_RECT) && _waypoint_count > 1) { - ShowBuildWaypointPicker(this); + if (HandlePlacePushButton(this, WID_RAT_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, HT_RECT)) { + if (_waypoint_count > 1) { + ShowBuildWaypointPicker(this); + } else { + _cur_waypoint_type = 0; + } } break; diff --git a/src/road_gui.cpp b/src/road_gui.cpp index a264bfc53f..d28a7141ce 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -534,7 +534,11 @@ struct BuildRoadToolbarWindow : Window { if (HandlePlacePushButton(this, WID_ROT_BUILD_WAYPOINT, SPR_CURSOR_WAYPOINT, HT_RECT)) { this->last_started_action = widget; _waypoint_count = RoadStopClass::Get(ROADSTOP_CLASS_WAYP)->GetSpecCount(); - if (_waypoint_count > 1) ShowBuildWaypointPicker(this); + if (_waypoint_count > 1) { + ShowBuildWaypointPicker(this); + } else { + _cur_waypoint_type = 0; + } } break;