summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/airport_gui.cpp4
-rw-r--r--src/autoreplace_gui.cpp4
-rw-r--r--src/bridge_gui.cpp2
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/cheat_gui.cpp2
-rw-r--r--src/company_cmd.cpp6
-rw-r--r--src/company_gui.cpp6
-rw-r--r--src/dock_gui.cpp8
-rw-r--r--src/engine_gui.cpp2
-rw-r--r--src/industry_gui.cpp2
-rw-r--r--src/network/network_client.cpp4
-rw-r--r--src/openttd.cpp3
-rw-r--r--src/order_gui.cpp2
-rw-r--r--src/rail_gui.cpp12
-rw-r--r--src/road_gui.cpp10
-rw-r--r--src/signs_gui.cpp2
-rw-r--r--src/station_gui.cpp2
-rw-r--r--src/terraform_gui.cpp4
-rw-r--r--src/timetable_gui.cpp2
-rw-r--r--src/tree_gui.cpp2
-rw-r--r--src/vehicle_gui.cpp2
-rw-r--r--src/window.cpp22
-rw-r--r--src/window_func.h1
-rw-r--r--src/window_gui.h1
24 files changed, 64 insertions, 43 deletions
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 25d920e4e..ac0b2e526 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -141,7 +141,7 @@ static const Widget _air_toolbar_widgets[] = {
static const WindowDesc _air_toolbar_desc = {
WDP_ALIGN_TBR, 22, 64, 36, 64, 36,
WC_BUILD_TOOLBAR, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION,
_air_toolbar_widgets,
};
@@ -302,7 +302,7 @@ static const Widget _build_airport_picker_widgets[] = {
static const WindowDesc _build_airport_desc = {
WDP_AUTO, WDP_AUTO, 148, 240, 148, 240,
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_build_airport_picker_widgets,
};
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index c36142bc9..d1f32f10d 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -472,14 +472,14 @@ static const Widget _replace_vehicle_widgets[] = {
static const WindowDesc _replace_rail_vehicle_desc = {
WDP_AUTO, WDP_AUTO, 456, 140, 456, 140,
WC_REPLACE_VEHICLE, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE | WDF_CONSTRUCTION,
_replace_vehicle_widgets,
};
static const WindowDesc _replace_vehicle_desc = {
WDP_AUTO, WDP_AUTO, 456, 118, 456, 118,
WC_REPLACE_VEHICLE, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE | WDF_CONSTRUCTION,
_replace_vehicle_widgets,
};
diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp
index 5ebc36f54..56e0c2e4a 100644
--- a/src/bridge_gui.cpp
+++ b/src/bridge_gui.cpp
@@ -270,7 +270,7 @@ static const Widget _build_bridge_widgets[] = {
static const WindowDesc _build_bridge_desc = {
WDP_AUTO, WDP_AUTO, 200, 114, 200, 114,
WC_BUILD_BRIDGE, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE | WDF_CONSTRUCTION,
_build_bridge_widgets,
};
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index a67ec2eb2..3f9118966 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -1182,7 +1182,7 @@ struct BuildVehicleWindow : Window {
static const WindowDesc _build_vehicle_desc = {
WDP_AUTO, WDP_AUTO, 240, 174, 240, 256,
WC_BUILD_VEHICLE, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE | WDF_CONSTRUCTION,
_build_vehicle_widgets,
};
diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp
index ac0324682..01a2c1e91 100644
--- a/src/cheat_gui.cpp
+++ b/src/cheat_gui.cpp
@@ -46,8 +46,6 @@ static int32 ClickChangeCompanyCheat(int32 p1, int32 p2)
while ((uint)p1 < GetCompanyPoolSize()) {
if (IsValidCompanyID((CompanyID)p1)) {
SetLocalCompany((CompanyID)p1);
-
- MarkWholeScreenDirty();
return _local_company;
}
p1 += p2;
diff --git a/src/company_cmd.cpp b/src/company_cmd.cpp
index a5ebc3e36..6ae724679 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -83,6 +83,12 @@ void SetLocalCompany(CompanyID new_company)
_settings_client.gui.autorenew_money = c->engine_renew_money;
InvalidateWindow(WC_GAME_OPTIONS, 0);
}
+
+ /* Delete any construction windows... */
+ DeleteConstructionWindows();
+
+ /* ... and redraw the whole screen. */
+ MarkWholeScreenDirty();
}
bool IsHumanCompany(CompanyID company)
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index 182d59514..26a0485a6 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -1096,7 +1096,7 @@ public:
static const WindowDesc _select_company_manager_face_desc = {
WDP_AUTO, WDP_AUTO, 190, 163, 190, 163,
WC_COMPANY_MANAGER_FACE, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION,
_select_company_manager_face_widgets,
};
@@ -1104,7 +1104,7 @@ static const WindowDesc _select_company_manager_face_desc = {
static const WindowDesc _select_company_manager_face_adv_desc = {
WDP_AUTO, WDP_AUTO, 220, 220, 220, 220,
WC_COMPANY_MANAGER_FACE, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION,
_select_company_manager_face_adv_widgets,
};
@@ -1518,7 +1518,7 @@ static const Widget _buy_company_widgets[] = {
static const WindowDesc _buy_company_desc = {
153, 171, 334, 137, 334, 137,
WC_BUY_COMPANY, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_buy_company_widgets,
};
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp
index caecae95a..61829988a 100644
--- a/src/dock_gui.cpp
+++ b/src/dock_gui.cpp
@@ -276,7 +276,7 @@ static const Widget _build_docks_toolb_widgets[] = {
static const WindowDesc _build_docks_toolbar_desc = {
WDP_ALIGN_TBR, 22, 160, 36, 160, 36,
WC_BUILD_TOOLBAR, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION,
_build_docks_toolb_widgets,
};
@@ -311,7 +311,7 @@ static const Widget _build_docks_scen_toolb_widgets[] = {
static const WindowDesc _build_docks_scen_toolbar_desc = {
WDP_AUTO, WDP_AUTO, 115, 36, 115, 36,
WC_SCEN_BUILD_TOOLBAR, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION,
_build_docks_scen_toolb_widgets,
};
@@ -397,7 +397,7 @@ static const Widget _build_dock_station_widgets[] = {
static const WindowDesc _build_dock_station_desc = {
WDP_AUTO, WDP_AUTO, 148, 75, 148, 75,
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_build_dock_station_widgets,
};
@@ -471,7 +471,7 @@ static const Widget _build_docks_depot_widgets[] = {
static const WindowDesc _build_docks_depot_desc = {
WDP_AUTO, WDP_AUTO, 204, 86, 204, 86,
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_build_docks_depot_widgets,
};
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index be6af32ce..91465e4bb 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -99,7 +99,7 @@ struct EnginePreviewWindow : Window {
static const WindowDesc _engine_preview_desc = {
WDP_CENTER, WDP_CENTER, 300, 192, 300, 192,
WC_ENGINE_PREVIEW, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_engine_preview_widgets,
};
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index a2943a309..f465fa09a 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -88,7 +88,7 @@ static const Widget _build_industry_widgets[] = {
static const WindowDesc _build_industry_desc = {
WDP_AUTO, WDP_AUTO, 170, 212, 170, 212,
WC_BUILD_INDUSTRY, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE | WDF_CONSTRUCTION,
_build_industry_widgets,
};
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 52cc42e8f..78e026b79 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -846,10 +846,6 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_MOVE)
if (client_id == _network_own_client_id) {
_network_playas = company_id;
SetLocalCompany(company_id);
-
- /* Disable any buttons in any windows the client is now not supposed to get to, and do it fast. */
- /* Do this ASAP else the client has a chance of sending DoCommands with an incorrect company_id (=kick)! */
- MarkWholeScreenDirty();
}
return NETWORK_RECV_STATUS_OKAY;
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 583815fdb..ac729c206 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -351,7 +351,6 @@ static void LoadIntroGame()
_pause_game = 0;
_cursor.fix_at = false;
- MarkWholeScreenDirty();
CheckForMissingGlyphsInLoadedLanguagePack();
@@ -792,8 +791,6 @@ static void MakeNewGame(bool from_heightmap)
static void MakeNewEditorWorldDone()
{
SetLocalCompany(OWNER_NONE);
-
- MarkWholeScreenDirty();
}
static void MakeNewEditorWorld()
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index a7a8dc5ce..b99892354 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -1274,7 +1274,7 @@ static const Widget _other_orders_widgets[] = {
static const WindowDesc _other_orders_desc = {
WDP_AUTO, WDP_AUTO, 386, 88, 386, 88,
WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE | WDF_CONSTRUCTION,
_other_orders_widgets,
};
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 309af58fc..6ebb9fc7e 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -793,7 +793,7 @@ static const Widget _build_rail_widgets[] = {
static const WindowDesc _build_rail_desc = {
WDP_ALIGN_TBR, 22, 350, 36, 350, 36,
WC_BUILD_TOOLBAR, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION,
_build_rail_widgets,
};
@@ -1335,7 +1335,7 @@ static const Widget _newstation_builder_widgets[] = {
static const WindowDesc _station_builder_desc = {
WDP_AUTO, WDP_AUTO, 148, 200, 148, 200,
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_station_builder_widgets,
};
@@ -1343,7 +1343,7 @@ static const WindowDesc _station_builder_desc = {
static const WindowDesc _newstation_builder_desc = {
WDP_AUTO, WDP_AUTO, 148, 290, 148, 290,
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_newstation_builder_widgets,
};
@@ -1512,7 +1512,7 @@ static const Widget _signal_builder_widgets[] = {
static const WindowDesc _signal_builder_desc = {
WDP_AUTO, WDP_AUTO, 154, 68, 154, 68,
WC_BUILD_SIGNAL, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_CONSTRUCTION,
_signal_builder_widgets,
};
@@ -1586,7 +1586,7 @@ static const Widget _build_depot_widgets[] = {
static const WindowDesc _build_depot_desc = {
WDP_AUTO, WDP_AUTO, 140, 122, 140, 122,
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_build_depot_widgets,
};
@@ -1687,7 +1687,7 @@ static const Widget _build_waypoint_widgets[] = {
static const WindowDesc _build_waypoint_desc = {
WDP_AUTO, WDP_AUTO, 344, 92, 344, 92,
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_build_waypoint_widgets,
};
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index b36c4a9b7..1f593c0fc 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -644,7 +644,7 @@ static const Widget _build_road_widgets[] = {
static const WindowDesc _build_road_desc = {
WDP_ALIGN_TBR, 22, 263, 36, 263, 36,
WC_BUILD_TOOLBAR, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION,
_build_road_widgets,
};
@@ -672,7 +672,7 @@ static const Widget _build_tramway_widgets[] = {
static const WindowDesc _build_tramway_desc = {
WDP_ALIGN_TBR, 22, 241, 36, 241, 36,
WC_BUILD_TOOLBAR, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION,
_build_tramway_widgets,
};
@@ -708,7 +708,7 @@ static const Widget _build_road_scen_widgets[] = {
static const WindowDesc _build_road_scen_desc = {
WDP_AUTO, WDP_AUTO, 197, 36, 197, 36,
WC_SCEN_BUILD_TOOLBAR, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION,
_build_road_scen_widgets,
};
@@ -787,7 +787,7 @@ static const Widget _build_road_depot_widgets[] = {
static const WindowDesc _build_road_depot_desc = {
WDP_AUTO, WDP_AUTO, 140, 122, 140, 122,
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_build_road_depot_widgets,
};
@@ -935,7 +935,7 @@ static const Widget _rv_station_picker_widgets[] = {
static const WindowDesc _rv_station_picker_desc = {
WDP_AUTO, WDP_AUTO, 207, 177, 207, 177,
WC_BUS_STATION, WC_BUILD_TOOLBAR,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_rv_station_picker_widgets,
};
diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp
index 0d3830d63..e77e103c5 100644
--- a/src/signs_gui.cpp
+++ b/src/signs_gui.cpp
@@ -332,7 +332,7 @@ static const Widget _query_sign_edit_widgets[] = {
static const WindowDesc _query_sign_edit_desc = {
190, 170, 260, 42, 260, 42,
WC_QUERY_STRING, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_query_sign_edit_widgets,
};
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 94b7afc01..675c7992d 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -1210,7 +1210,7 @@ struct SelectStationWindow : Window {
static const WindowDesc _select_station_desc = {
WDP_AUTO, WDP_AUTO, 200, 92, 200, 182,
WC_SELECT_STATION, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE | WDF_CONSTRUCTION,
_select_station_widgets,
};
diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp
index 82d2f5c42..d05e35cdc 100644
--- a/src/terraform_gui.cpp
+++ b/src/terraform_gui.cpp
@@ -328,7 +328,7 @@ static const Widget _terraform_widgets[] = {
static const WindowDesc _terraform_desc = {
WDP_ALIGN_TBR, 22 + 36, 158, 36, 158, 36,
WC_SCEN_LAND_GEN, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION,
_terraform_widgets,
};
@@ -709,7 +709,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window {
static const WindowDesc _scen_edit_land_gen_desc = {
WDP_AUTO, WDP_AUTO, 163, 103, 163, 103,
WC_SCEN_LAND_GEN, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION,
_scen_edit_land_gen_widgets,
};
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index 7d1b463e4..e764c5141 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -357,7 +357,7 @@ static const Widget _timetable_widgets[] = {
static const WindowDesc _timetable_desc = {
WDP_AUTO, WDP_AUTO, 400, 130, 400, 130,
WC_VEHICLE_TIMETABLE, WC_VEHICLE_VIEW,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE | WDF_CONSTRUCTION,
_timetable_widgets,
};
diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp
index 045de6c36..904ce0df2 100644
--- a/src/tree_gui.cpp
+++ b/src/tree_gui.cpp
@@ -174,7 +174,7 @@ static const Widget _build_trees_widgets[] = {
static const WindowDesc _build_trees_desc = {
WDP_AUTO, WDP_AUTO, 143, 184, 143, 184,
WC_BUILD_TREES, WC_NONE,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
_build_trees_widgets,
};
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 2bfe386bf..4a6b7d9c8 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -414,7 +414,7 @@ static const Widget _vehicle_refit_widgets[] = {
static const WindowDesc _vehicle_refit_desc = {
WDP_AUTO, WDP_AUTO, 240, 174, 240, 174,
WC_VEHICLE_REFIT, WC_VEHICLE_VIEW,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE | WDF_CONSTRUCTION,
_vehicle_refit_widgets,
};
diff --git a/src/window.cpp b/src/window.cpp
index f5fed776d..5161bea4f 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2191,6 +2191,28 @@ restart_search:
}
}
+/**
+ * Delete all windows that are used for construction of vehicle etc.
+ * Once done with that invalidate the others to ensure they get refreshed too.
+ */
+void DeleteConstructionWindows()
+{
+ Window *w;
+
+restart_search:
+ /* When we find the window to delete, we need to restart the search
+ * as deleting this window could cascade in deleting (many) others
+ * anywhere in the z-array */
+ FOR_ALL_WINDOWS_FROM_BACK(w) {
+ if (w->desc_flags & WDF_CONSTRUCTION) {
+ delete w;
+ goto restart_search;
+ }
+ }
+
+ FOR_ALL_WINDOWS_FROM_BACK(w) w->SetDirty();
+}
+
/** Delete all always on-top windows to get an empty screen */
void HideVitalWindows()
{
diff --git a/src/window_func.h b/src/window_func.h
index 2e3767c97..0c175a8f4 100644
--- a/src/window_func.h
+++ b/src/window_func.h
@@ -28,6 +28,7 @@ void InvalidateWindowClassesData(WindowClass cls, int data = 0);
void DeleteNonVitalWindows();
void DeleteAllNonVitalWindows();
+void DeleteConstructionWindows();
void HideVitalWindows();
void ShowVitalWindows();
diff --git a/src/window_gui.h b/src/window_gui.h
index 2e6fc2f63..85e4bce3b 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -124,6 +124,7 @@ enum WindowDefaultFlag {
WDF_STD_TOOLTIPS = 1 << 0, ///< use standard routine when displaying tooltips
WDF_DEF_WIDGET = 1 << 1, ///< Default widget control for some widgets in the on click event, @see DispatchLeftClickEvent()
WDF_STD_BTN = 1 << 2, ///< Default handling for close and titlebar widgets (widget no 0 and 1)
+ WDF_CONSTRUCTION = 1 << 3, ///< This window is used for construction; close it whenever changing company.
WDF_UNCLICK_BUTTONS = 1 << 4, ///< Unclick buttons when the window event times out
WDF_STICKY_BUTTON = 1 << 5, ///< Set window to sticky mode; they are not closed unless closed with 'X' (widget 2)