powerfunding money and houses setting

This commit is contained in:
Pavel Stupnikov
2015-03-27 11:45:58 +03:00
parent 87301a82bd
commit dd23a24569
5 changed files with 35 additions and 0 deletions

View File

@@ -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

View File

@@ -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));

View File

@@ -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

View File

@@ -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]

View File

@@ -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;