From 6c1ddab7423c4b2c76f87a55a0b610fe074d8cd2 Mon Sep 17 00:00:00 2001 From: ilmikko Date: Sat, 29 Mar 2025 18:56:52 +0100 Subject: [PATCH] Allow renaming towns in multiplayer --- src/settings_type.h | 1 + src/town_gui.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/settings_type.h b/src/settings_type.h index f6dd5bc98c..8af5b0e1a6 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -536,6 +536,7 @@ struct EconomySettings { TownCargoGenMode town_cargogen_mode; ///< algorithm for generating cargo from houses, @see TownCargoGenMode bool allow_town_roads; ///< towns are allowed to build roads (always allowed when generating world / in SE) TownFounding found_town; ///< town founding. + bool town_renaming_allowed; ///< users can rename towns, even in multiplayer PlaceHouses place_houses; ///< players are allowed to place town houses. bool station_noise_level; ///< build new airports when the town noise level is still within accepted limits uint16_t town_noise_population[4]; ///< population to base decision on noise evaluation (@see town_council_tolerance) diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 944ad4b5dd..6e6a89031b 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -383,7 +383,11 @@ public: nvp->InitializeViewport(this, this->town->xy, ScaleZoomGUI(ZOOM_LVL_TOWN)); /* disable renaming town in network games if you are not the server */ - this->SetWidgetDisabledState(WID_TV_CHANGE_NAME, _networking && !_network_server); + bool renaming_disabled = _networking && !_network_server; + if (_settings_game.economy.town_renaming_allowed) { + renaming_disabled = false; + } + this->SetWidgetDisabledState(WID_TV_CHANGE_NAME, renaming_disabled); } void Close([[maybe_unused]] int data = 0) override