Changeset - r26848:319b6ad2b742
[Not reviewed]
master
0 4 0
Rubidium - 16 months ago 2023-01-15 06:55:54
rubidium@openttd.org
Change #10077: make maximum loan a positive multiple of the loan interval

And set the minimum maximum loan to the value of loan interval, so there is
always an amount of money to lend. Compared to being allowed to set max loan
to 0 and never be allowed to lend any money.
4 files changed with 11 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/company_cmd.cpp
Show inline comments
 
@@ -561,7 +561,8 @@ Company *DoStartupNewCompany(bool is_ai,
 
	ResetCompanyLivery(c);
 
	_company_colours[c->index] = (Colours)c->colour;
 

	
 
	c->money = c->current_loan = (std::min<int64>(INITIAL_LOAN, _economy.max_loan) * _economy.inflation_prices >> 16) / 50000 * 50000;
 
	/* Scale the initial loan based on the inflation rounded down to the loan interval. The maximum loan has already been inflation adjusted. */
 
	c->money = c->current_loan = std::min<int64>((INITIAL_LOAN * _economy.inflation_prices >> 16) / LOAN_INTERVAL * LOAN_INTERVAL, _economy.max_loan);
 

	
 
	std::fill(c->share_owners.begin(), c->share_owners.end(), INVALID_OWNER);
 

	
src/economy.cpp
Show inline comments
 
@@ -757,8 +757,8 @@ bool AddInflation(bool check_year)
 
 */
 
void RecomputePrices()
 
{
 
	/* Setup maximum loan */
 
	_economy.max_loan = ((uint64)_settings_game.difficulty.max_loan * _economy.inflation_prices >> 16) / 50000 * 50000;
 
	/* Setup maximum loan as a rounded down multiple of LOAN_INTERVAL. */
 
	_economy.max_loan = ((uint64)_settings_game.difficulty.max_loan * _economy.inflation_prices >> 16) / LOAN_INTERVAL * LOAN_INTERVAL;
 

	
 
	/* Setup price bases */
 
	for (Price i = PR_BEGIN; i < PR_END; i++) {
src/table/settings/company_settings.ini
Show inline comments
 
@@ -89,7 +89,7 @@ max      = 800
 
str      = STR_CONFIG_SETTING_SERVINT_TRAINS
 
strhelp  = STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT
 
strval   = STR_CONFIG_SETTING_SERVINT_VALUE
 
pre_cb   = [](auto new_value) { return CanUpdateServiceInterval(VEH_TRAIN, new_value); }
 
pre_cb   = [](auto &new_value) { return CanUpdateServiceInterval(VEH_TRAIN, new_value); }
 
post_cb  = [](auto new_value) { UpdateServiceInterval(VEH_TRAIN, new_value); }
 

	
 
[SDT_VAR]
 
@@ -102,7 +102,7 @@ max      = 800
 
str      = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES
 
strhelp  = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES_HELPTEXT
 
strval   = STR_CONFIG_SETTING_SERVINT_VALUE
 
pre_cb   = [](auto new_value) { return CanUpdateServiceInterval(VEH_ROAD, new_value); }
 
pre_cb   = [](auto &new_value) { return CanUpdateServiceInterval(VEH_ROAD, new_value); }
 
post_cb  = [](auto new_value) { UpdateServiceInterval(VEH_ROAD, new_value); }
 

	
 
[SDT_VAR]
 
@@ -115,7 +115,7 @@ max      = 800
 
str      = STR_CONFIG_SETTING_SERVINT_SHIPS
 
strhelp  = STR_CONFIG_SETTING_SERVINT_SHIPS_HELPTEXT
 
strval   = STR_CONFIG_SETTING_SERVINT_VALUE
 
pre_cb   = [](auto new_value) { return CanUpdateServiceInterval(VEH_SHIP, new_value); }
 
pre_cb   = [](auto &new_value) { return CanUpdateServiceInterval(VEH_SHIP, new_value); }
 
post_cb  = [](auto new_value) { UpdateServiceInterval(VEH_SHIP, new_value); }
 

	
 
[SDT_VAR]
 
@@ -128,5 +128,5 @@ max      = 800
 
str      = STR_CONFIG_SETTING_SERVINT_AIRCRAFT
 
strhelp  = STR_CONFIG_SETTING_SERVINT_AIRCRAFT_HELPTEXT
 
strval   = STR_CONFIG_SETTING_SERVINT_VALUE
 
pre_cb   = [](auto new_value) { return CanUpdateServiceInterval(VEH_AIRCRAFT, new_value); }
 
pre_cb   = [](auto &new_value) { return CanUpdateServiceInterval(VEH_AIRCRAFT, new_value); }
 
post_cb  = [](auto new_value) { UpdateServiceInterval(VEH_AIRCRAFT, new_value); }
src/table/settings/difficulty_settings.ini
Show inline comments
 
@@ -98,9 +98,10 @@ type     = SLE_UINT32
 
from     = SLV_97
 
flags    = SF_NEWGAME_ONLY | SF_SCENEDIT_TOO | SF_GUI_CURRENCY
 
def      = 300000
 
min      = 0
 
min      = LOAN_INTERVAL
 
max      = 2000000000
 
interval = 50000
 
pre_cb   = [](auto &new_value) { new_value = (new_value + LOAN_INTERVAL / 2) / LOAN_INTERVAL * LOAN_INTERVAL; return true; }
 
interval = LOAN_INTERVAL
 
str      = STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN
 
strhelp  = STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_HELPTEXT
 
strval   = STR_JUST_CURRENCY_LONG
0 comments (0 inline, 0 general)