Mercurial > hg > openttd
changeset 12553:8d5c10ef911d draft
(svn r16991) -Change: make 'remove waypoint' draggable
author | rubidium <rubidium@openttd.org> |
---|---|
date | Thu, 30 Jul 2009 15:16:19 +0000 |
parents | 92b34b5e5b00 |
children | bd7515ef20f9 |
files | src/rail_gui.cpp |
diffstat | 1 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -149,7 +149,7 @@ static void PlaceRail_Waypoint(TileIndex tile) { if (_remove_button_clicked) { - DoCommandP(tile, 0, 0, CMD_REMOVE_FROM_RAIL_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT), CcPlaySound1E); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_REMOVE_STATION); } else { DoCommandP(tile, _cur_waypoint_type, 0, CMD_BUILD_RAIL_WAYPOINT | CMD_MSG(STR_CANT_BUILD_TRAIN_WAYPOINT), CcPlaySound1E); } @@ -167,8 +167,7 @@ static void PlaceRail_Station(TileIndex tile) { if (_remove_button_clicked) { - VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_REMOVE_STATION); - VpSetPlaceSizingLimit(-1); + VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_REMOVE_STATION); } else if (_settings_client.gui.station_dragdrop) { VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION); VpSetPlaceSizingLimit(_settings_game.station.station_spread); @@ -750,11 +749,19 @@ case DDSP_REMOVE_STATION: case DDSP_BUILD_STATION: - if (_remove_button_clicked) { - DoCommandP(end_tile, start_tile, 0, CMD_REMOVE_FROM_RAIL_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION), CcPlaySound1E); - break; + if (this->IsWidgetLowered(RTW_BUILD_STATION)) { + /* Station */ + if (_remove_button_clicked) { + DoCommandP(end_tile, start_tile, 0, CMD_REMOVE_FROM_RAIL_STATION | CMD_MSG(STR_CANT_REMOVE_PART_OF_STATION), CcPlaySound1E); + } else { + HandleStationPlacement(start_tile, end_tile); + } + } else { + /* Waypoint */ + if (_remove_button_clicked) { + DoCommandP(end_tile, start_tile, 0, CMD_REMOVE_FROM_RAIL_WAYPOINT | CMD_MSG(STR_CANT_REMOVE_TRAIN_WAYPOINT), CcPlaySound1E); + } } - HandleStationPlacement(start_tile, end_tile); break; } }