@@ -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_picke
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,
@@ -472,14 +472,14 @@ static const Widget _replace_vehicle_wid
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,
@@ -270,7 +270,7 @@ static const Widget _build_bridge_widget
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,
@@ -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,
@@ -46,8 +46,6 @@ static int32 ClickChangeCompanyCheat(int
while ((uint)p1 < GetCompanyPoolSize()) {
if (IsValidCompanyID((CompanyID)p1)) {
SetLocalCompany((CompanyID)p1);
MarkWholeScreenDirty();
return _local_company;
}
p1 += p2;
@@ -83,6 +83,12 @@ void SetLocalCompany(CompanyID new_compa
_settings_client.gui.autorenew_money = c->engine_renew_money;
InvalidateWindow(WC_GAME_OPTIONS, 0);
/* Delete any construction windows... */
DeleteConstructionWindows();
/* ... and redraw the whole screen. */
bool IsHumanCompany(CompanyID company)
@@ -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_
static const WindowDesc _select_company_manager_face_adv_desc = {
WDP_AUTO, WDP_AUTO, 220, 220, 220, 220,
_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,
_buy_company_widgets,
@@ -276,7 +276,7 @@ static const Widget _build_docks_toolb_w
static const WindowDesc _build_docks_toolbar_desc = {
WDP_ALIGN_TBR, 22, 160, 36, 160, 36,
_build_docks_toolb_widgets,
@@ -311,7 +311,7 @@ static const Widget _build_docks_scen_to
static const WindowDesc _build_docks_scen_toolbar_desc = {
WDP_AUTO, WDP_AUTO, 115, 36, 115, 36,
WC_SCEN_BUILD_TOOLBAR, WC_NONE,
_build_docks_scen_toolb_widgets,
@@ -397,7 +397,7 @@ static const Widget _build_dock_station_
static const WindowDesc _build_dock_station_desc = {
WDP_AUTO, WDP_AUTO, 148, 75, 148, 75,
_build_dock_station_widgets,
@@ -471,7 +471,7 @@ static const Widget _build_docks_depot_w
static const WindowDesc _build_docks_depot_desc = {
WDP_AUTO, WDP_AUTO, 204, 86, 204, 86,
WC_BUILD_DEPOT, WC_BUILD_TOOLBAR,
_build_docks_depot_widgets,
@@ -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,
_engine_preview_widgets,
@@ -88,7 +88,7 @@ static const Widget _build_industry_widg
static const WindowDesc _build_industry_desc = {
WDP_AUTO, WDP_AUTO, 170, 212, 170, 212,
WC_BUILD_INDUSTRY, WC_NONE,
_build_industry_widgets,
@@ -846,10 +846,6 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER
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)! */
return NETWORK_RECV_STATUS_OKAY;
@@ -351,7 +351,6 @@ static void LoadIntroGame()
_pause_game = 0;
_cursor.fix_at = false;
CheckForMissingGlyphsInLoadedLanguagePack();
@@ -792,8 +791,6 @@ static void MakeNewGame(bool from_height
static void MakeNewEditorWorldDone()
{
SetLocalCompany(OWNER_NONE);
static void MakeNewEditorWorld()
@@ -1274,7 +1274,7 @@ static const Widget _other_orders_widget
static const WindowDesc _other_orders_desc = {
WDP_AUTO, WDP_AUTO, 386, 88, 386, 88,
WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
_other_orders_widgets,
@@ -793,7 +793,7 @@ static const Widget _build_rail_widgets[
static const WindowDesc _build_rail_desc = {
WDP_ALIGN_TBR, 22, 350, 36, 350, 36,
_build_rail_widgets,
@@ -1335,7 +1335,7 @@ static const Widget _newstation_builder_
static const WindowDesc _station_builder_desc = {
WDP_AUTO, WDP_AUTO, 148, 200, 148, 200,
_station_builder_widgets,
@@ -1343,7 +1343,7 @@ static const WindowDesc _station_builder
static const WindowDesc _newstation_builder_desc = {
WDP_AUTO, WDP_AUTO, 148, 290, 148, 290,
_newstation_builder_widgets,
@@ -1512,7 +1512,7 @@ static const Widget _signal_builder_widg
static const WindowDesc _signal_builder_desc = {
WDP_AUTO, WDP_AUTO, 154, 68, 154, 68,
WC_BUILD_SIGNAL, WC_BUILD_TOOLBAR,
_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,
_build_depot_widgets,
@@ -1687,7 +1687,7 @@ static const Widget _build_waypoint_widg
static const WindowDesc _build_waypoint_desc = {
WDP_AUTO, WDP_AUTO, 344, 92, 344, 92,
_build_waypoint_widgets,
@@ -644,7 +644,7 @@ static const Widget _build_road_widgets[
static const WindowDesc _build_road_desc = {
WDP_ALIGN_TBR, 22, 263, 36, 263, 36,
_build_road_widgets,
@@ -672,7 +672,7 @@ static const Widget _build_tramway_widge
static const WindowDesc _build_tramway_desc = {
WDP_ALIGN_TBR, 22, 241, 36, 241, 36,
_build_tramway_widgets,
@@ -708,7 +708,7 @@ static const Widget _build_road_scen_wid
static const WindowDesc _build_road_scen_desc = {
WDP_AUTO, WDP_AUTO, 197, 36, 197, 36,
_build_road_scen_widgets,
@@ -787,7 +787,7 @@ static const Widget _build_road_depot_wi
static const WindowDesc _build_road_depot_desc = {
_build_road_depot_widgets,
@@ -935,7 +935,7 @@ static const Widget _rv_station_picker_w
static const WindowDesc _rv_station_picker_desc = {
WDP_AUTO, WDP_AUTO, 207, 177, 207, 177,
WC_BUS_STATION, WC_BUILD_TOOLBAR,
_rv_station_picker_widgets,
@@ -332,7 +332,7 @@ static const Widget _query_sign_edit_wid
static const WindowDesc _query_sign_edit_desc = {
190, 170, 260, 42, 260, 42,
WC_QUERY_STRING, WC_NONE,
_query_sign_edit_widgets,
@@ -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,
_select_station_widgets,
@@ -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,
_terraform_widgets,
@@ -709,7 +709,7 @@ struct ScenarioEditorLandscapeGeneration
static const WindowDesc _scen_edit_land_gen_desc = {
WDP_AUTO, WDP_AUTO, 163, 103, 163, 103,
_scen_edit_land_gen_widgets,
@@ -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,
_timetable_widgets,
@@ -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,
_build_trees_widgets,
@@ -414,7 +414,7 @@ static const Widget _vehicle_refit_widge
static const WindowDesc _vehicle_refit_desc = {
WDP_AUTO, WDP_AUTO, 240, 174, 240, 174,
WC_VEHICLE_REFIT, WC_VEHICLE_VIEW,
_vehicle_refit_widgets,
@@ -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()
@@ -28,6 +28,7 @@ void InvalidateWindowClassesData(WindowC
void DeleteNonVitalWindows();
void DeleteAllNonVitalWindows();
void DeleteConstructionWindows();
void HideVitalWindows();
void ShowVitalWindows();
@@ -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)
Status change: