Add setting to scale station cargo capacity and rating tolerance by size

pull/161/head
Jonathan G Rennison 4 years ago
parent 1917a3e0f8
commit 271fac01a7

@ -1205,6 +1205,8 @@ STR_CONFIG_SETTING_CATCHMENT_INCREASE :Increase statio
STR_CONFIG_SETTING_CATCHMENT_INCREASE_HELPTEXT :Increase radius of station catchment areas by this many tiles
STR_CONFIG_SETTING_STATION_RATING_CARGO_CLASS_WAIT_TIME :Station rating tolerance to waiting time depends on cargo class: {STRING2}
STR_CONFIG_SETTING_STATION_RATING_CARGO_CLASS_WAIT_TIME_HELPTEXT:When enabled, the effect of the waiting time since the last cargo pickup on the station rating for that cargo depends on the cargo class. Passengers, mail, armoured cargo, refrigerated cargo and express cargo, are varyingly less tolerant to waiting. Bulk and liquid cargos are more tolerant.
STR_CONFIG_SETTING_STATION_RATING_SIZE_CARGO_AMOUNT :Station cargo capacity and rating tolerance depend on station size: {STRING2}
STR_CONFIG_SETTING_STATION_RATING_SIZE_CARGO_AMOUNT_HELPTEXT :When enabled, the cargo capacity of stations before waiting cargo is truncated and the effect of the waiting cargo amount on the station rating for that cargo depend on the size of the station. Larger stations can store more cargo and are more tolerant of large amounts of waiting cargo.
STR_CONFIG_SETTING_EXTRADYNAMITE :Allow removal of more town-owned roads, bridges and tunnels: {STRING2}
STR_CONFIG_SETTING_EXTRADYNAMITE_HELPTEXT :Make it easier to remove town-owned infrastructure and buildings
STR_CONFIG_SETTING_TRAIN_LENGTH :Maximum length of trains: {STRING2}

@ -1949,6 +1949,7 @@ static SettingsContainer &GetSettingsTree()
environment->Add(new SettingEntry("station.modified_catchment"));
environment->Add(new SettingEntry("station.catchment_increase"));
environment->Add(new SettingEntry("station.cargo_class_rating_wait_time"));
environment->Add(new SettingEntry("station.station_size_rating_cargo_amount"));
}
SettingsPage *ai = main->Add(new SettingsPage(STR_CONFIG_SETTING_AI));

@ -618,7 +618,8 @@ struct StationSettings {
bool never_expire_airports; ///< never expire airports
byte station_spread; ///< amount a station may spread
byte catchment_increase; ///< amount by which station catchment is increased
byte cargo_class_rating_wait_time; ///< station rating tolerance to time since last cargo pickup depends on cargo class
bool cargo_class_rating_wait_time; ///< station rating tolerance to time since last cargo pickup depends on cargo class
bool station_size_rating_cargo_amount; ///< station rating tolerance to waiting cargo amount depends on station size
};
/** Default settings for vehicles. */

@ -3780,11 +3780,16 @@ static void UpdateStationRating(Station *st)
if (waittime <= 3) rating += 35;
rating -= 90;
if (ge->max_waiting_cargo <= 1500) rating += 55;
if (ge->max_waiting_cargo <= 1000) rating += 35;
if (ge->max_waiting_cargo <= 600) rating += 10;
if (ge->max_waiting_cargo <= 300) rating += 20;
if (ge->max_waiting_cargo <= 100) rating += 10;
uint normalised_max_waiting_cargo = ge->max_waiting_cargo;
if (_settings_game.station.station_size_rating_cargo_amount) {
normalised_max_waiting_cargo *= 8;
if (st->station_tiles > 1) normalised_max_waiting_cargo /= st->station_tiles;
}
if (normalised_max_waiting_cargo <= 1500) rating += 55;
if (normalised_max_waiting_cargo <= 1000) rating += 35;
if (normalised_max_waiting_cargo <= 600) rating += 10;
if (normalised_max_waiting_cargo <= 300) rating += 20;
if (normalised_max_waiting_cargo <= 100) rating += 10;
}
if (Company::IsValidID(st->owner) && HasBit(st->town->statues, st->owner)) rating += 26;
@ -3826,11 +3831,17 @@ static void UpdateStationRating(Station *st)
static const uint WAITING_CARGO_CUT_FACTOR = 1 << 6;
static const uint MAX_WAITING_CARGO = 1 << 15;
if (waiting > WAITING_CARGO_THRESHOLD) {
uint difference = waiting - WAITING_CARGO_THRESHOLD;
waiting -= (difference / WAITING_CARGO_CUT_FACTOR);
uint normalised_waiting_cargo_threshold = WAITING_CARGO_THRESHOLD;
if (_settings_game.station.station_size_rating_cargo_amount) {
if (st->station_tiles > 1) normalised_waiting_cargo_threshold *= st->station_tiles;
normalised_waiting_cargo_threshold /= 8;
}
waiting = min(waiting, MAX_WAITING_CARGO);
if (waiting > normalised_waiting_cargo_threshold) {
const uint difference = waiting - normalised_waiting_cargo_threshold;
waiting -= (difference / WAITING_CARGO_CUT_FACTOR);
const uint normalised_max_waiting_cargo = normalised_waiting_cargo_threshold * (MAX_WAITING_CARGO / WAITING_CARGO_THRESHOLD);
waiting = min(waiting, normalised_max_waiting_cargo);
waiting_changed = true;
}

@ -1764,6 +1764,14 @@ str = STR_CONFIG_SETTING_STATION_RATING_CARGO_CLASS_WAIT_TIME
strhelp = STR_CONFIG_SETTING_STATION_RATING_CARGO_CLASS_WAIT_TIME_HELPTEXT
patxname = ""station_rating.station.cargo_class_rating_wait_time""
[SDT_BOOL]
base = GameSettings
var = station.station_size_rating_cargo_amount
def = false
str = STR_CONFIG_SETTING_STATION_RATING_SIZE_CARGO_AMOUNT
strhelp = STR_CONFIG_SETTING_STATION_RATING_SIZE_CARGO_AMOUNT_HELPTEXT
patxname = ""station_rating.station.station_size_rating_cargo_amount""
[SDT_BOOL]
base = GameSettings
var = station.serve_neutral_industries

Loading…
Cancel
Save