(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
authorrubidium
Sat, 24 Nov 2007 08:56:29 +0000
changeset 7949 730724a67d80
parent 7948 e408508f5727
child 7950 5574c10f6098
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
src/rail_gui.cpp
src/road_gui.cpp
--- a/src/rail_gui.cpp	Sat Nov 24 08:45:04 2007 +0000
+++ b/src/rail_gui.cpp	Sat Nov 24 08:56:29 2007 +0000
@@ -65,7 +65,7 @@
 static void GenericPlaceRail(TileIndex tile, int cmd)
 {
 	DoCommandP(tile, _cur_railtype, cmd, CcPlaySound1E,
-		_remove_button_clicked ?
+		(_remove_button_clicked || _ctrl_pressed) ?
 		CMD_REMOVE_SINGLE_RAIL | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) | CMD_NO_WATER :
 		CMD_BUILD_SINGLE_RAIL | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) | CMD_NO_WATER
 	);
@@ -139,10 +139,10 @@
 
 static void PlaceRail_Waypoint(TileIndex tile)
 {
-	if (!_remove_button_clicked) {
+	if (_remove_button_clicked || _ctrl_pressed) {
+		DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT));
+	} else {
 		DoCommandP(tile, _cur_waypoint_type, 0, CcPlaySound1E, CMD_BUILD_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_BUILD_TRAIN_WAYPOINT));
-	} else {
-		DoCommandP(tile, 0, 0, CcPlaySound1E, CMD_REMOVE_TRAIN_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT));
 	}
 }
 
@@ -157,7 +157,7 @@
 
 static void PlaceRail_Station(TileIndex tile)
 {
-	if (_remove_button_clicked) {
+	if (_remove_button_clicked || _ctrl_pressed) {
 		VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_REMOVE_STATION);
 	} else if (_railstation.dragdrop) {
 		VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION);
@@ -184,16 +184,16 @@
 
 	Track track = FindFirstTrack(trackbits);
 
-	if (!_remove_button_clicked) {
+	if (_remove_button_clicked || _ctrl_pressed) {
+		DoCommandP(tile, track, 0, CcPlaySound1E,
+			CMD_REMOVE_SIGNALS | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM));
+	} else {
 		uint32 p1 = track;
 		SB(p1, 3, 1, _ctrl_pressed);
 		SB(p1, 4, 1, _cur_year < _patches.semaphore_build_before);
 
 		DoCommandP(tile, p1, 0, CcPlaySound1E,
 			CMD_BUILD_SIGNALS | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE));
-	} else {
-		DoCommandP(tile, track, 0, CcPlaySound1E,
-			CMD_REMOVE_SIGNALS | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM));
 	}
 }
 
@@ -347,7 +347,7 @@
 static void DoRailroadTrack(int mode)
 {
 	DoCommandP(TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), _cur_railtype | (mode << 4), NULL,
-		_remove_button_clicked ?
+		(_remove_button_clicked || _ctrl_pressed) ?
 		CMD_REMOVE_RAILROAD_TRACK | CMD_NO_WATER | CMD_MSG(STR_1012_CAN_T_REMOVE_RAILROAD_TRACK) :
 		CMD_BUILD_RAILROAD_TRACK  | CMD_NO_WATER | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK)
 	);
@@ -389,7 +389,7 @@
 		TileVirtXY(thd->selend.x, thd->selend.y),
 		p2,
 		CcPlaySound1E,
-		_remove_button_clicked ?
+		(_remove_button_clicked || _ctrl_pressed)?
 			CMD_REMOVE_SIGNAL_TRACK | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) :
 			CMD_BUILD_SIGNAL_TRACK  | CMD_NO_WATER | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE)
 	);
@@ -511,12 +511,9 @@
 					ShowBuildBridgeWindow(start_tile, end_tile, _cur_railtype);
 					break;
 
-				case DDSP_PLACE_AUTORAIL: {
-					bool old = _remove_button_clicked;
-					if (_ctrl_pressed) _remove_button_clicked = true;
+				case DDSP_PLACE_AUTORAIL:
 					HandleAutodirPlacement();
-					_remove_button_clicked = old;
-				} break;
+					break;
 
 				case DDSP_BUILD_SIGNALS:
 					HandleAutoSignalPlacement();
@@ -539,12 +536,9 @@
 					break;
 
 				case DDSP_PLACE_RAIL_NE:
-				case DDSP_PLACE_RAIL_NW: {
-					bool old = _remove_button_clicked;
-					if (_ctrl_pressed) _remove_button_clicked = true;
+				case DDSP_PLACE_RAIL_NW:
 					DoRailroadTrack(e->we.place.select_proc == DDSP_PLACE_RAIL_NE ? TRACK_X : TRACK_Y);
-					_remove_button_clicked = old;
-				} break;
+					break;
 			}
 		}
 		break;
--- a/src/road_gui.cpp	Sat Nov 24 08:45:04 2007 +0000
+++ b/src/road_gui.cpp	Sat Nov 24 08:56:29 2007 +0000
@@ -212,7 +212,7 @@
 
 static void PlaceRoad_BusStation(TileIndex tile)
 {
-	if (_remove_button_clicked) {
+	if (_remove_button_clicked || _ctrl_pressed) {
 		DoCommandP(tile, 0, RoadStop::BUS, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[RoadStop::BUS]));
 	} else {
 		PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | RoadStop::BUS, CMD_BUILD_ROAD_STOP | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[RoadStop::BUS]));
@@ -221,7 +221,7 @@
 
 static void PlaceRoad_TruckStation(TileIndex tile)
 {
-	if (_remove_button_clicked) {
+	if (_remove_button_clicked || _ctrl_pressed) {
 		DoCommandP(tile, 0, RoadStop::TRUCK, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[RoadStop::TRUCK]));
 	} else {
 		PlaceRoadStop(tile, (_ctrl_pressed << 5) | RoadTypeToRoadTypes(_cur_roadtype) << 2 | RoadStop::TRUCK, CMD_BUILD_ROAD_STOP | CMD_NO_WATER | CMD_MSG(_road_type_infos[_cur_roadtype].err_build_station[RoadStop::TRUCK]));