summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis <39921028+alex6m59@users.noreply.github.com>2018-06-06 14:08:22 +0200
committerPeterN <peter@fuzzle.org>2018-06-06 13:08:22 +0100
commit25dbc6542cab0c5a751894317f038b2f7f9ac8c2 (patch)
tree9913069d3e729143a34e8fff2844cda6bc34b4cb
parent0bd1022238613917b8f9ac42d0f021de56057af2 (diff)
downloadopenttd-25dbc6542cab0c5a751894317f038b2f7f9ac8c2.tar.xz
Fix #6659: Bus stations can be demolished when not in demolish mode (#6815)
For Bus and Road stations only, if you are in demolish mode and click on the station without releasing the button. Then you cancel demolish mode with R key. Finally you release the mouse button. The station was demolished, instead of being built. The demolish mode was not checked when mouse up event occured.
-rw-r--r--src/road_gui.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index 801d33435..6faa42262 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -633,24 +633,28 @@ struct BuildRoadToolbarWindow : Window {
break;
case DDSP_BUILD_BUSSTOP:
- PlaceRoadStop(start_tile, end_tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | ROADSTOP_BUS, CMD_BUILD_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[ROADSTOP_BUS]));
+ case DDSP_REMOVE_BUSSTOP:
+ if (this->IsWidgetLowered(WID_ROT_BUS_STATION)) {
+ if (_remove_button_clicked) {
+ TileArea ta(start_tile, end_tile);
+ DoCommandP(ta.tile, ta.w | ta.h << 8, (_ctrl_pressed << 1) | ROADSTOP_BUS, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_BUS]), CcPlaySound_SPLAT_OTHER);
+ } else {
+ PlaceRoadStop(start_tile, end_tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | ROADSTOP_BUS, CMD_BUILD_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[ROADSTOP_BUS]));
+ }
+ }
break;
case DDSP_BUILD_TRUCKSTOP:
- PlaceRoadStop(start_tile, end_tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | ROADSTOP_TRUCK, CMD_BUILD_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[ROADSTOP_TRUCK]));
+ case DDSP_REMOVE_TRUCKSTOP:
+ if (this->IsWidgetLowered(WID_ROT_TRUCK_STATION)) {
+ if (_remove_button_clicked) {
+ TileArea ta(start_tile, end_tile);
+ DoCommandP(ta.tile, ta.w | ta.h << 8, (_ctrl_pressed << 1) | ROADSTOP_TRUCK, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_TRUCK]), CcPlaySound_SPLAT_OTHER);
+ } else {
+ PlaceRoadStop(start_tile, end_tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | ROADSTOP_TRUCK, CMD_BUILD_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[ROADSTOP_TRUCK]));
+ }
+ }
break;
-
- case DDSP_REMOVE_BUSSTOP: {
- TileArea ta(start_tile, end_tile);
- DoCommandP(ta.tile, ta.w | ta.h << 8, (_ctrl_pressed << 1) | ROADSTOP_BUS, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_BUS]), CcPlaySound_SPLAT_OTHER);
- break;
- }
-
- case DDSP_REMOVE_TRUCKSTOP: {
- TileArea ta(start_tile, end_tile);
- DoCommandP(ta.tile, ta.w | ta.h << 8, (_ctrl_pressed << 1) | ROADSTOP_TRUCK, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[ROADSTOP_TRUCK]), CcPlaySound_SPLAT_OTHER);
- break;
- }
}
}
}