From fab048a1169075bec84aa7d082adbb219eebc0cb Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 28 Jun 2013 19:09:47 +0000 Subject: [PATCH] (svn r25496) [1.3] -Backport from trunk: - Fix: When town creation failed, removing remnants of the construction failed on protected houses [FS#5603] (r25429) - Fix: There were two hotkeys to toggle between 'unload' and 'unload if possible' (r25406) - Fix: The size of station construction windows could oscillate when resizing the window moved the mouse into the window [FS#5596] (r25395) - Fix: Restrict renaming engines to the server, just like renaming towns (r25394) --- src/airport_gui.cpp | 6 ++++-- src/build_vehicle_gui.cpp | 4 ++++ src/command.cpp | 2 +- src/dock_gui.cpp | 6 ++++-- src/newgrf_house.cpp | 4 ++-- src/order_gui.cpp | 1 - src/rail_gui.cpp | 6 ++++-- src/road_gui.cpp | 6 ++++-- 8 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 8d97add910..97d5a816cc 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -391,8 +391,10 @@ public: top = DrawStationCoverageAreaText(panel_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL; } - /* Resize background if the text is not equally long as the window. */ - if (top > bottom || (top < bottom && panel_nwi->current_y > panel_nwi->smallest_y)) { + /* Resize background if the window is too small. + * Never make the window smaller to avoid oscillating if the size change affects the acceptance. + * (This is the case, if making the window bigger moves the mouse into the window.) */ + if (top > bottom) { ResizeWindow(this, 0, top - bottom); } } diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index b54927dbdc..dcbcf55c34 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -13,6 +13,7 @@ #include "engine_base.h" #include "engine_func.h" #include "station_base.h" +#include "network/network.h" #include "articulated_vehicles.h" #include "textbuf_gui.h" #include "command_func.h" @@ -970,6 +971,9 @@ struct BuildVehicleWindow : Window { * So we just hide it, and enlarge the Rename button by the now vacant place. */ if (this->listview_mode) this->GetWidget(WID_BV_BUILD_SEL)->SetDisplayedPlane(SZSP_NONE); + /* disable renaming engines in network games if you are not the server */ + this->SetWidgetDisabledState(WID_BV_RENAME, _networking && !_network_server); + NWidgetCore *widget = this->GetWidget(WID_BV_LIST); widget->tool_tip = STR_BUY_VEHICLE_TRAIN_LIST_TOOLTIP + type; diff --git a/src/command.cpp b/src/command.cpp index eef7652f40..34d97b8751 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -252,7 +252,7 @@ static const Command _command_proc_table[] = { DEF_CMD(CmdWantEnginePreview, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_WANT_ENGINE_PREVIEW DEF_CMD(CmdRenameVehicle, CMD_STR_CTRL, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_VEHICLE - DEF_CMD(CmdRenameEngine, CMD_STR_CTRL, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_ENGINE + DEF_CMD(CmdRenameEngine, CMD_STR_CTRL | CMD_SERVER, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_ENGINE DEF_CMD(CmdRenameCompany, CMD_STR_CTRL, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_COMPANY DEF_CMD(CmdRenamePresident, CMD_STR_CTRL, CMDT_OTHER_MANAGEMENT ), // CMD_RENAME_PRESIDENT diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index d3c8a280e6..c0a684661b 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -422,8 +422,10 @@ public: int bottom = back_nwi->pos_y + back_nwi->current_y; top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL; top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL; - /* Resize background if the text is not equally long as the window. */ - if (top > bottom || (top < bottom && back_nwi->current_y > back_nwi->smallest_y)) { + /* Resize background if the window is too small. + * Never make the window smaller to avoid oscillating if the size change affects the acceptance. + * (This is the case, if making the window bigger moves the mouse into the window.) */ + if (top > bottom) { ResizeWindow(this, 0, top - bottom); } } diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index d8cd3b7678..2f03060a6c 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -535,9 +535,9 @@ bool CanDeleteHouse(TileIndex tile) { const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile)); - /* Humans are always allowed to remove buildings, as is water and + /* Humans are always allowed to remove buildings, as is water and disasters and * anyone using the scenario editor. */ - if (Company::IsValidHumanID(_current_company) || _current_company == OWNER_WATER || _current_company == OWNER_NONE) { + if (Company::IsValidHumanID(_current_company) || _current_company == OWNER_WATER || _current_company == OWNER_NONE || _game_mode == GM_EDITOR || _generating_world) { return true; } diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 2e9a7fb161..d6614bff50 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1516,7 +1516,6 @@ Hotkey OrdersWindow::order_hotkeys[] = { Hotkey('K', "unload", 0, &OrdersWindow::OrderClick_Unload), Hotkey((uint16)0, "nearest_depot", 0, &OrdersWindow::OrderClick_NearestDepot), Hotkey((uint16)0, "always_service", 0, &OrdersWindow::OrderClick_Service), - Hotkey((uint16)0, "force_unload", 0, &OrdersWindow::OrderClick_Unload), Hotkey((uint16)0, "transfer", 0, &OrdersWindow::OrderHotkey_Transfer), Hotkey((uint16)0, "no_unload", 0, &OrdersWindow::OrderHotkey_NoUnload), Hotkey((uint16)0, "no_load", 0, &OrdersWindow::OrderHotkey_NoLoad), diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index cee1903a04..ec85264c5e 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1012,8 +1012,10 @@ public: int bottom = cov->pos_y + cov->current_y; top = DrawStationCoverageAreaText(left, right, top, SCT_ALL, rad, false) + WD_PAR_VSEP_NORMAL; top = DrawStationCoverageAreaText(left, right, top, SCT_ALL, rad, true) + WD_PAR_VSEP_NORMAL; - /* Resize the coverage text space if the text is not equally long as the window. */ - if (top != bottom) { + /* Resize background if the window is too small. + * Never make the window smaller to avoid oscillating if the size change affects the acceptance. + * (This is the case, if making the window bigger moves the mouse into the window.) */ + if (top > bottom) { this->coverage_height += top - bottom; this->ReInit(); } diff --git a/src/road_gui.cpp b/src/road_gui.cpp index bf4ef40d17..4f34230af7 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -972,8 +972,10 @@ struct BuildRoadStationWindow : public PickerWindowBase { int bottom = back_nwi->pos_y + back_nwi->current_y; top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, false) + WD_PAR_VSEP_NORMAL; top = DrawStationCoverageAreaText(back_nwi->pos_x + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, sct, rad, true) + WD_PAR_VSEP_NORMAL; - /* Resize background if the text is not equally long as the window. */ - if (top > bottom || (top < bottom && back_nwi->current_y > back_nwi->smallest_y)) { + /* Resize background if the window is too small. + * Never make the window smaller to avoid oscillating if the size change affects the acceptance. + * (This is the case, if making the window bigger moves the mouse into the window.) */ + if (top > bottom) { ResizeWindow(this, 0, top - bottom); } }