Fixed joining stations, broken by confirmation dialog

This commit is contained in:
pelya
2016-05-18 09:37:38 +03:00
committed by Sergii Pylypenko
parent ff28829393
commit a724419cc9
5 changed files with 14 additions and 5 deletions

View File

@@ -29,6 +29,7 @@
#include "vehicle_func.h"
#include "gui.h"
#include "command_func.h"
#include "build_confirmation_func.h"
#include "widgets/airport_widget.h"
@@ -157,8 +158,10 @@ struct BuildAirToolbarWindow : Window {
{
MoveAllHiddenWindowsBackToScreen();
this->RaiseButtons();
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
DeleteWindowById(WC_SELECT_STATION, 0);
if (!ConfirmationWindowShown()) {
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_AIR);
DeleteWindowById(WC_SELECT_STATION, 0);
}
ResetObjectToPlace();
}

View File

@@ -27,6 +27,7 @@
#include "hotkeys.h"
#include "gui.h"
#include "zoom_func.h"
#include "build_confirmation_func.h"
#include "widgets/dock_widget.h"
@@ -287,6 +288,7 @@ struct BuildDocksToolbarWindow : Window {
MoveAllHiddenWindowsBackToScreen();
this->RaiseButtons();
if (ConfirmationWindowShown()) return;
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_WATER);
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER);
DeleteWindowById(WC_SELECT_STATION, 0);

View File

@@ -771,12 +771,13 @@ struct BuildRailToolbarWindow : Window {
this->DisableWidget(WID_RAT_REMOVE);
this->SetWidgetDirty(WID_RAT_REMOVE);
if (ConfirmationWindowShown()) return;
DeleteWindowById(WC_BUILD_SIGNAL, TRANSPORT_RAIL);
DeleteWindowById(WC_BUILD_STATION, TRANSPORT_RAIL);
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_RAIL);
DeleteWindowById(WC_BUILD_WAYPOINT, TRANSPORT_RAIL);
DeleteWindowById(WC_SELECT_STATION, 0);
if (!ConfirmationWindowShown()) DeleteWindowByClass(WC_BUILD_BRIDGE);
DeleteWindowByClass(WC_BUILD_BRIDGE);
}
virtual void SelectLastTool()
@@ -934,6 +935,7 @@ static void HandleStationPlacement(TileIndex start, TileIndex end)
uint32 p2 = _railstation.station_class | _railstation.station_type << 8 | INVALID_STATION << 16;
CommandContainer cmdcont = { ta.tile, p1, p2, CMD_BUILD_RAIL_STATION | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION), CcStation, "" };
printf("Rail station ctrl pressed %d\n", _ctrl_pressed);
ShowSelectStationIfNeeded(cmdcont, ta);
}

View File

@@ -547,11 +547,12 @@ struct BuildRoadToolbarWindow : Window {
this->SetWidgetDirty(WID_ROT_REMOVE);
this->SetWidgetDirty(WID_ROT_ONE_WAY);
if (ConfirmationWindowShown()) return;
DeleteWindowById(WC_BUS_STATION, TRANSPORT_ROAD);
DeleteWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD);
DeleteWindowById(WC_BUILD_DEPOT, TRANSPORT_ROAD);
DeleteWindowById(WC_SELECT_STATION, 0);
if (!ConfirmationWindowShown()) DeleteWindowByClass(WC_BUILD_BRIDGE);
DeleteWindowByClass(WC_BUILD_BRIDGE);
}
virtual void SelectLastTool()

View File

@@ -1443,7 +1443,8 @@ void Window::InitializeData(WindowNumber window_number)
if (this->window_class != WC_BUILD_CONFIRMATION &&
this->window_class != WC_TOOLTIPS &&
this->window_class != WC_NEWS_WINDOW &&
this->window_class != WC_BUILD_BRIDGE) {
this->window_class != WC_BUILD_BRIDGE &&
this->window_class != WC_SELECT_STATION) {
HideBuildConfirmationWindow();
}