mirror of https://github.com/OpenTTD/OpenTTD
(svn r11505) -Fix/Feature: make CTRL work on all road/rail construction options that 'work' with the 'Bulldozer' button instead of only a few.
parent
ea072322fa
commit
81c7ba42af
|
@ -65,7 +65,7 @@ void CcPlaySound1E(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
static void GenericPlaceRail(TileIndex tile, int cmd)
|
static void GenericPlaceRail(TileIndex tile, int cmd)
|
||||||
{
|
{
|
||||||
DoCommandP(tile, _cur_railtype, cmd, CcPlaySound1E,
|
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_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
|
CMD_BUILD_SINGLE_RAIL | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK) | CMD_NO_WATER
|
||||||
);
|
);
|
||||||
|
@ -139,10 +139,10 @@ static void PlaceRail_Depot(TileIndex tile)
|
||||||
|
|
||||||
static void PlaceRail_Waypoint(TileIndex tile)
|
static void PlaceRail_Waypoint(TileIndex tile)
|
||||||
{
|
{
|
||||||
if (!_remove_button_clicked) {
|
if (_remove_button_clicked || _ctrl_pressed) {
|
||||||
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));
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ void CcStation(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
static void PlaceRail_Station(TileIndex tile)
|
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);
|
VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_REMOVE_STATION);
|
||||||
} else if (_railstation.dragdrop) {
|
} else if (_railstation.dragdrop) {
|
||||||
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION);
|
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION);
|
||||||
|
@ -184,16 +184,16 @@ static void GenericPlaceSignals(TileIndex tile)
|
||||||
|
|
||||||
Track track = FindFirstTrack(trackbits);
|
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;
|
uint32 p1 = track;
|
||||||
SB(p1, 3, 1, _ctrl_pressed);
|
SB(p1, 3, 1, _ctrl_pressed);
|
||||||
SB(p1, 4, 1, _cur_year < _patches.semaphore_build_before);
|
SB(p1, 4, 1, _cur_year < _patches.semaphore_build_before);
|
||||||
|
|
||||||
DoCommandP(tile, p1, 0, CcPlaySound1E,
|
DoCommandP(tile, p1, 0, CcPlaySound1E,
|
||||||
CMD_BUILD_SIGNALS | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE));
|
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 BuildRailClick_Convert(Window *w)
|
||||||
static void DoRailroadTrack(int mode)
|
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,
|
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_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)
|
CMD_BUILD_RAILROAD_TRACK | CMD_NO_WATER | CMD_MSG(STR_1011_CAN_T_BUILD_RAILROAD_TRACK)
|
||||||
);
|
);
|
||||||
|
@ -389,7 +389,7 @@ static void HandleAutoSignalPlacement()
|
||||||
TileVirtXY(thd->selend.x, thd->selend.y),
|
TileVirtXY(thd->selend.x, thd->selend.y),
|
||||||
p2,
|
p2,
|
||||||
CcPlaySound1E,
|
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_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)
|
CMD_BUILD_SIGNAL_TRACK | CMD_NO_WATER | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE)
|
||||||
);
|
);
|
||||||
|
@ -511,12 +511,9 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e)
|
||||||
ShowBuildBridgeWindow(start_tile, end_tile, _cur_railtype);
|
ShowBuildBridgeWindow(start_tile, end_tile, _cur_railtype);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DDSP_PLACE_AUTORAIL: {
|
case DDSP_PLACE_AUTORAIL:
|
||||||
bool old = _remove_button_clicked;
|
|
||||||
if (_ctrl_pressed) _remove_button_clicked = true;
|
|
||||||
HandleAutodirPlacement();
|
HandleAutodirPlacement();
|
||||||
_remove_button_clicked = old;
|
break;
|
||||||
} break;
|
|
||||||
|
|
||||||
case DDSP_BUILD_SIGNALS:
|
case DDSP_BUILD_SIGNALS:
|
||||||
HandleAutoSignalPlacement();
|
HandleAutoSignalPlacement();
|
||||||
|
@ -539,12 +536,9 @@ static void BuildRailToolbWndProc(Window *w, WindowEvent *e)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DDSP_PLACE_RAIL_NE:
|
case DDSP_PLACE_RAIL_NE:
|
||||||
case DDSP_PLACE_RAIL_NW: {
|
case DDSP_PLACE_RAIL_NW:
|
||||||
bool old = _remove_button_clicked;
|
|
||||||
if (_ctrl_pressed) _remove_button_clicked = true;
|
|
||||||
DoRailroadTrack(e->we.place.select_proc == DDSP_PLACE_RAIL_NE ? TRACK_X : TRACK_Y);
|
DoRailroadTrack(e->we.place.select_proc == DDSP_PLACE_RAIL_NE ? TRACK_X : TRACK_Y);
|
||||||
_remove_button_clicked = old;
|
break;
|
||||||
} break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -212,7 +212,7 @@ static void PlaceRoadStop(TileIndex tile, uint32 p2, uint32 cmd)
|
||||||
|
|
||||||
static void PlaceRoad_BusStation(TileIndex tile)
|
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]));
|
DoCommandP(tile, 0, RoadStop::BUS, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[RoadStop::BUS]));
|
||||||
} else {
|
} 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]));
|
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_BusStation(TileIndex tile)
|
||||||
|
|
||||||
static void PlaceRoad_TruckStation(TileIndex tile)
|
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]));
|
DoCommandP(tile, 0, RoadStop::TRUCK, CcPlaySound1D, CMD_REMOVE_ROAD_STOP | CMD_MSG(_road_type_infos[_cur_roadtype].err_remove_station[RoadStop::TRUCK]));
|
||||||
} else {
|
} 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]));
|
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]));
|
||||||
|
|
Loading…
Reference in New Issue