summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-30 15:16:19 +0000
committerrubidium <rubidium@openttd.org>2009-07-30 15:16:19 +0000
commitde99f212dc5c9829ba031b6c66f2ef88a1a29666 (patch)
treef2296ebd15a2ff2e9b04b62f96dfa9d8ed48e483
parent37e6f6a00395147ef55764926e203a1c8bfd6572 (diff)
downloadopenttd-de99f212dc5c9829ba031b6c66f2ef88a1a29666.tar.xz
(svn r16991) -Change: make 'remove waypoint' draggable
-rw-r--r--src/rail_gui.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 52b497cda..f8bdec455 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -149,7 +149,7 @@ static void PlaceRail_Depot(TileIndex tile)
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 @@ void CcStation(bool success, TileIndex tile, uint32 p1, uint32 p2)
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 @@ struct BuildRailToolbarWindow : Window {
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;
}
}