summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoïc Guilloux <glx22@users.noreply.github.com>2021-07-19 22:38:36 +0200
committerGitHub <noreply@github.com>2021-07-19 22:38:36 +0200
commit9b0bb21f3b0cb9fb29ef7413900752eca5421b2a (patch)
tree154e4d4a49b988b72757fb7ee08c25cdc7975815
parentd1cf56609defb1ea8bd5d642f6df1bccb000d7d6 (diff)
downloadopenttd-9b0bb21f3b0cb9fb29ef7413900752eca5421b2a.tar.xz
Fix 57734fd: Don't enable rename button for network clients in build vehicle window (#9452)
-rw-r--r--src/build_vehicle_gui.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index f88a7ee14..547ac3e00 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -1097,9 +1097,6 @@ struct BuildVehicleWindow : Window {
* So we just hide it, and enlarge the Rename button by the now vacant place. */
if (this->listview_mode) this->GetWidget<NWidgetStacked>(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<NWidgetCore>(WID_BV_LIST);
widget->tool_tip = STR_BUY_VEHICLE_TRAIN_LIST_TOOLTIP + type;
@@ -1608,7 +1605,10 @@ struct BuildVehicleWindow : Window {
this->GenerateBuildList();
this->vscroll->SetCount((uint)this->eng_list.size());
- this->SetWidgetsDisabledState(this->sel_engine == INVALID_ENGINE, WID_BV_SHOW_HIDE, WID_BV_BUILD, WID_BV_RENAME, WIDGET_LIST_END);
+ this->SetWidgetsDisabledState(this->sel_engine == INVALID_ENGINE, WID_BV_SHOW_HIDE, WID_BV_BUILD, WIDGET_LIST_END);
+
+ /* Disable renaming engines in network games if you are not the server. */
+ this->SetWidgetDisabledState(WID_BV_RENAME, this->sel_engine == INVALID_ENGINE || (_networking && !_network_server));
this->DrawWidgets();