added inflation factor (estimated to 3% a year) as requested in https://www.tt-forums.net/viewtopic.php?t=73249#p1182135 and mentioned as an issue in https://dev.openttdcoop.org/issues/8407 - hopefully it works as expected.

This commit is contained in:
2017-06-27 17:56:13 +02:00
parent eaa1ae11cc
commit ebf7f0f46b
3 changed files with 32 additions and 16 deletions

View File

@@ -29,7 +29,8 @@ class CompanyGoal {
subsidyfactor = GSController.GetSetting("subsidy_factor");
rewardfactor_town = GSController.GetSetting("rewardfactor_town");
rewardfactor_ind = GSController.GetSetting("rewardfactor_ind");
inflation_factor = 1.0;
displayed_string = null;
displayed_count = null;
@@ -42,7 +43,19 @@ class CompanyGoal {
this.cargo = cargo;
this.accept = accept;
this.wanted_amount = wanted_amount;
this.reward = (this.wanted_amount * subsidyfactor) / 100; // estimated factor, better would be a random value
local inflationOn = GSGameSettings.GetValue("inflation");
if (inflationOn) {
local gamets = GSDate.GetCurrentDate();
local starting_year = GSGameSettings.GetValue("starting_year");
local gameyears = GSDate.GetYear(gamets) - starting_year;
inflation_factor = 1.0 + (gameyears * 0.03); // calculate new inflation factor; estimate 3% each year
}
local inflation_percent = inflation_factor * 100;
this.reward = (this.wanted_amount * subsidyfactor * inflation_factor) / 100; // estimated factor, better would be a random value
this.ResetTimeout();
// Construct goal if a company id was provided.
@@ -62,6 +75,9 @@ class CompanyGoal {
this.reward = (this.reward * rewardfactor_ind) / 100;
}
local goal_text, goal_news_text;
this.reward = this.reward.tointeger();
if (this.reward > 0) {
goal_text = GSText(GSText.STR_COMPANY_GOAL_REWARD, cargo.cid, this.wanted_amount, destination_string, this.reward);
goal_news_text = GSText(GSText.STR_COMPANY_GOAL_REWARD_NEWS, cargo.cid, this.wanted_amount, destination_string_news, this.reward);

View File

@@ -17,7 +17,7 @@
* Fifth Floor, Boston, MA 02110-1301 USA.
*/
SAVEGAME_VERSION <- 5; // Set manually if/when save games break.
SAVEGAME_VERSION <- 6; // Set manually if/when save games break.
MINCOMPATIBLE_SAVEGAME_VERSION <- 5; // cset: c87ea540a037
PROGRAM_VERSION <- Syntax error, set by 'make bundle'.
@@ -41,13 +41,13 @@ class BeeRewardInfo extends GSInfo {
function BeeRewardInfo::GetSettings()
{
GSInfo.AddSetting({name="num_goals",
description="Number of goals for a company (1-10)",
description="Number of goals for a company (1-32)",
min_value=1,
max_value=10,
easy_value=5,
medium_value=5,
hard_value=5,
custom_value=5,
max_value=32,
easy_value=16,
medium_value=8,
hard_value=4,
custom_value=8,
flags=GSInfo.CONFIG_NONE});
GSInfo.AddSetting({name="wait_years",
description="Time to wait before first delivery (4-20 year)",
@@ -62,10 +62,10 @@ function BeeRewardInfo::GetSettings()
description="Cargo amount multiplier (50-2000%)",
min_value=50,
max_value=2000,
easy_value=50,
easy_value=1000,
medium_value=500,
hard_value=1000,
custom_value=100,
hard_value=100,
custom_value=500,
step_size = 10,
flags=GSInfo.CONFIG_INGAME});
GSInfo.AddSetting({name="pass_weight",
@@ -108,9 +108,9 @@ function BeeRewardInfo::GetSettings()
GSInfo.AddSetting({name="rewardfactor_town",
description="Extra factor to be multiplied with reward for towns",
min_value=0,
max_value=200,
easy_value=200,
medium_value=100,
max_value=1000,
easy_value=500,
medium_value=200,
hard_value=0,
custom_value=0,
step_size=1,

View File

@@ -1,6 +1,6 @@
##plural 0
STR_COMPANY_GOAL_REWARD :Liefere {GOLD}{CARGO_LONG} {ORANGE}nach {STRING}{ORANGE} bringt {WHITE}{STRING}{CURRENCY_LONG} {ORANGE}ein
STR_COMPANY_GOAL_REWARD :Lieferung von {GOLD}{CARGO_LONG} {ORANGE}nach {STRING}{ORANGE} bringt {WHITE}{STRING}{CURRENCY_LONG} {ORANGE}ein
STR_COMPANY_GOAL :Liefere {GOLD}{CARGO_LONG} {ORANGE}nach {STRING}
STR_COMPANY_GOAL_REWARD_NEWS :Neues Ziel! Liefere {CARGO_LONG} nach {STRING} für {STRING}{CURRENCY_LONG}
STR_COMPANY_GOAL_NEWS :Neues Ziel! Liefere {CARGO_LONG} nach {STRING}