@@ -1071,13 +1071,18 @@ Money GetTransportedGoodsIncome(uint num_pieces, uint dist, uint16 transit_days,
|
|||||||
static const int TIME_FACTOR_FRAC_BITS = 4;
|
static const int TIME_FACTOR_FRAC_BITS = 4;
|
||||||
static const int TIME_FACTOR_FRAC = 1 << TIME_FACTOR_FRAC_BITS;
|
static const int TIME_FACTOR_FRAC = 1 << TIME_FACTOR_FRAC_BITS;
|
||||||
|
|
||||||
|
if (_settings_game.economy.payment_algorithm == CPA_TRADITIONAL) transit_days = std::min<uint16>(transit_days, 0xFFu);
|
||||||
|
|
||||||
const int days1 = cs->transit_days[0];
|
const int days1 = cs->transit_days[0];
|
||||||
const int days2 = cs->transit_days[1];
|
const int days2 = cs->transit_days[1];
|
||||||
const int days_over_days1 = std::max( transit_days - days1, 0);
|
const int days_over_days1 = std::max( transit_days - days1, 0);
|
||||||
const int days_over_days2 = std::max(days_over_days1 - days2, 0);
|
const int days_over_days2 = std::max(days_over_days1 - days2, 0);
|
||||||
int days_over_max = MIN_TIME_FACTOR - MAX_TIME_FACTOR;
|
int days_over_max = 0;
|
||||||
if (days2 > -days_over_max) days_over_max += transit_days - days1;
|
if (_settings_game.economy.payment_algorithm == CPA_MODERN) {
|
||||||
else days_over_max += 2 * (transit_days - days1) - days2;
|
days_over_max = MIN_TIME_FACTOR - MAX_TIME_FACTOR;
|
||||||
|
if (days2 > -days_over_max) days_over_max += transit_days - days1;
|
||||||
|
else days_over_max += 2 * (transit_days - days1) - days2;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The time factor is calculated based on the time it took
|
* The time factor is calculated based on the time it took
|
||||||
|
@@ -234,4 +234,11 @@ static const uint LOCK_DEPOT_TILE_FACTOR = 2;
|
|||||||
struct CargoPayment;
|
struct CargoPayment;
|
||||||
typedef uint32 CargoPaymentID;
|
typedef uint32 CargoPaymentID;
|
||||||
|
|
||||||
|
enum CargoPaymentAlgorithm : byte {
|
||||||
|
CPA_BEGIN = 0, ///< Used for iterations and limit testing
|
||||||
|
CPA_TRADITIONAL = 0, ///< Traditional algorithm
|
||||||
|
CPA_MODERN, ///< Modern algorithm
|
||||||
|
CPA_END, ///< Used for iterations and limit testing
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* ECONOMY_TYPE_H */
|
#endif /* ECONOMY_TYPE_H */
|
||||||
|
@@ -606,6 +606,11 @@ STR_CONFIG_SETTING_TOWN_GROWTH_CARGO_TRANSPORTED_HELPTEXT :Percentage of t
|
|||||||
STR_CONFIG_SETTING_RANDOM_ROAD_RECONSTRUCTION :Probability of random town road re-construction: {STRING2}
|
STR_CONFIG_SETTING_RANDOM_ROAD_RECONSTRUCTION :Probability of random town road re-construction: {STRING2}
|
||||||
STR_CONFIG_SETTING_RANDOM_ROAD_RECONSTRUCTION_HELPTEXT :The probability of town roads randomly being re-constructed (0 = off, 1000 = max)
|
STR_CONFIG_SETTING_RANDOM_ROAD_RECONSTRUCTION_HELPTEXT :The probability of town roads randomly being re-constructed (0 = off, 1000 = max)
|
||||||
|
|
||||||
|
STR_CONFIG_SETTING_CARGO_PAYMENT_ALGORITHM :Cargo payment algorithm: {STRING2}
|
||||||
|
STR_CONFIG_SETTING_CARGO_PAYMENT_ALGORITHM_HELPTEXT :The algorithm to use to calculate how much money to pay for delivering cargo to its destination.
|
||||||
|
STR_CONFIG_SETTING_CARGO_PAYMENT_ALGORITHM_TRADITIONAL :Traditional
|
||||||
|
STR_CONFIG_SETTING_CARGO_PAYMENT_ALGORITHM_MODERN :Modern
|
||||||
|
|
||||||
STR_CONFIG_SETTING_TOWN_MIN_DISTANCE :Minimum distance between towns: {STRING2}
|
STR_CONFIG_SETTING_TOWN_MIN_DISTANCE :Minimum distance between towns: {STRING2}
|
||||||
STR_CONFIG_SETTING_TOWN_MIN_DISTANCE_HELPTEXT :Set the minimum distance in tiles between towns for map generation and random founding
|
STR_CONFIG_SETTING_TOWN_MIN_DISTANCE_HELPTEXT :Set the minimum distance in tiles between towns for map generation and random founding
|
||||||
|
|
||||||
|
@@ -4187,6 +4187,10 @@ bool AfterLoadGame()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SlXvIsFeatureMissing(XSLFI_MORE_CARGO_AGE) && IsSavegameVersionBefore(SLV_MORE_CARGO_AGE)) {
|
||||||
|
_settings_game.economy.payment_algorithm = CPA_TRADITIONAL;
|
||||||
|
}
|
||||||
|
|
||||||
InitializeRoadGUI();
|
InitializeRoadGUI();
|
||||||
|
|
||||||
/* This needs to be done after conversion. */
|
/* This needs to be done after conversion. */
|
||||||
|
@@ -2061,6 +2061,7 @@ static SettingsContainer &GetSettingsTree()
|
|||||||
accounting->Add(new SettingEntry("difficulty.vehicle_costs_in_depot"));
|
accounting->Add(new SettingEntry("difficulty.vehicle_costs_in_depot"));
|
||||||
accounting->Add(new SettingEntry("difficulty.vehicle_costs_when_stopped"));
|
accounting->Add(new SettingEntry("difficulty.vehicle_costs_when_stopped"));
|
||||||
accounting->Add(new SettingEntry("difficulty.construction_cost"));
|
accounting->Add(new SettingEntry("difficulty.construction_cost"));
|
||||||
|
accounting->Add(new SettingEntry("economy.payment_algorithm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPage *vehicles = main->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLES));
|
SettingsPage *vehicles = main->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLES));
|
||||||
|
@@ -705,6 +705,7 @@ struct EconomySettings {
|
|||||||
uint8 day_length_factor; ///< factor which the length of day is multiplied
|
uint8 day_length_factor; ///< factor which the length of day is multiplied
|
||||||
uint16 random_road_reconstruction; ///< chance out of 1000 per tile loop for towns to start random road re-construction
|
uint16 random_road_reconstruction; ///< chance out of 1000 per tile loop for towns to start random road re-construction
|
||||||
bool disable_inflation_newgrf_flag; ///< Disable NewGRF inflation flag
|
bool disable_inflation_newgrf_flag; ///< Disable NewGRF inflation flag
|
||||||
|
CargoPaymentAlgorithm payment_algorithm; ///< Cargo payment algorithm
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LinkGraphSettings {
|
struct LinkGraphSettings {
|
||||||
|
@@ -3237,6 +3237,20 @@ def = false
|
|||||||
cat = SC_EXPERT
|
cat = SC_EXPERT
|
||||||
patxname = ""economy.disable_inflation_newgrf_flag""
|
patxname = ""economy.disable_inflation_newgrf_flag""
|
||||||
|
|
||||||
|
[SDT_VAR]
|
||||||
|
var = economy.payment_algorithm
|
||||||
|
type = SLE_UINT8
|
||||||
|
flags = SF_GUI_DROPDOWN
|
||||||
|
def = CPA_MODERN
|
||||||
|
min = CPA_BEGIN
|
||||||
|
max = CPA_END - 1
|
||||||
|
interval = 1
|
||||||
|
str = STR_CONFIG_SETTING_CARGO_PAYMENT_ALGORITHM
|
||||||
|
strhelp = STR_CONFIG_SETTING_CARGO_PAYMENT_ALGORITHM_HELPTEXT
|
||||||
|
strval = STR_CONFIG_SETTING_CARGO_PAYMENT_ALGORITHM_TRADITIONAL
|
||||||
|
cat = SC_BASIC
|
||||||
|
patxname = ""economy.payment_algorithm""
|
||||||
|
|
||||||
##
|
##
|
||||||
[SDT_VAR]
|
[SDT_VAR]
|
||||||
var = pf.wait_for_pbs_path
|
var = pf.wait_for_pbs_path
|
||||||
|
Reference in New Issue
Block a user