diff --git a/src/lang/english.txt b/src/lang/english.txt index 09df60a663..b5749351f0 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -5272,3 +5272,6 @@ STR_CB_GUI_TOWN_VIEW_BUTTON :{BLACK}Town vie STR_CB_GUI_TOWN_VIEW_TOOLTIP :{BLACK}Show information on town STR_CONFIG_SETTING_WARN_IF_RUNWAY_IS_TOO_SHORT :Warn if airplane has in its orders an airport whose runway is too short + +STR_CONFIG_SETTING_POWERFUND_MONEY :Powerfund minimum needed money for fund: {STRING2} +STR_CONFIG_SETTING_POWERFUND_HOUSES :Maximum amount of houses to powerfund up to diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index b421326013..00154aa639 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1565,6 +1565,8 @@ static SettingsContainer &GetSettingsTree() interface->Add(new SettingEntry("gui.timetable_in_ticks")); interface->Add(new SettingEntry("gui.timetable_arrival_departure")); interface->Add(new SettingEntry("gui.expenses_layout")); + interface->Add(new SettingEntry("gui.powerfund_money")); + interface->Add(new SettingEntry("gui.powerfund_houses")); } SettingsPage *advisors = main->Add(new SettingsPage(STR_CONFIG_SETTING_ADVISORS)); diff --git a/src/settings_type.h b/src/settings_type.h index 81ebd7bf51..56d25ee792 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -174,6 +174,9 @@ struct GUISettings { bool show_industry_forbidden_tiles; ///< higlight areas where industry placement is forbidden regardless of terrain bool runway_too_short_warn; ///< warn about aircrafts using too short runways + uint32 powerfund_money; ///< minimum amount of money for powerfund to work + uint16 powerfund_houses; ///< powerfunding maximum houses limit + /** * Returns true when the user has sufficient privileges to edit newgrfs on a running game * @return whether the user has sufficient privileges to edit newgrfs in an existing game diff --git a/src/table/settings.ini b/src/table/settings.ini index f976ee65e4..ba7bebd4df 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -4081,5 +4081,26 @@ flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC def = true str = STR_CONFIG_SETTING_WARN_IF_RUNWAY_IS_TOO_SHORT +[SDTC_VAR] +var = gui.powerfund_money +type = SLE_UINT +flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC +guiflags = SGF_CURRENCY +def = 200000 +min = 0 +max = 2000000 +str = STR_CONFIG_SETTING_POWERFUND_MONEY +strval = STR_JUST_CURRENCY_LONG + +[SDTC_VAR] +var = gui.powerfund_houses +type = SLE_INT16 +flags = SLF_NOT_IN_CONFIG | SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC +def = 10000 +min = 0 +max = 10000 +str = STR_CONFIG_SETTING_POWERFUND_HOUSES +strval = STR_JUST_COMMA + [SDT_END] diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 3a30c7b4a9..ce7e9834cc 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -831,6 +831,12 @@ static void DoRegularFunding(Town *t) { bool fund_regularly = HasBit(t->fund_regularly, _local_company); bool do_powerfund = HasBit(t->do_powerfund, _local_company); + + if (do_powerfund && (_settings_client.gui.powerfund_money > Company::Get(_local_company)->money || + _settings_client.gui.powerfund_houses < t->cache.num_houses)) { + do_powerfund = false; + } + if (!fund_regularly && !do_powerfund) return;