From d2d8a8681419ab5a4ad9e0127bf598ed73f358cb Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Mon, 4 Jun 2018 20:43:05 +0100 Subject: [PATCH] Add setting: station rating waiting time tolerance depends on cargo class --- src/lang/english.txt | 2 ++ src/settings_gui.cpp | 1 + src/settings_type.h | 1 + src/station_cmd.cpp | 13 ++++++++++++- src/table/settings.ini | 8 ++++++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index 3895ec243d..90fe421ff0 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1180,6 +1180,8 @@ STR_CONFIG_SETTING_CATCHMENT :Allow more real STR_CONFIG_SETTING_CATCHMENT_HELPTEXT :Have differently sized catchment areas for different types of stations and airports STR_CONFIG_SETTING_CATCHMENT_INCREASE :Increase station catchment radius: {STRING2} 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_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} diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index c55e768eeb..ca3e46f554 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1830,6 +1830,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")); } SettingsPage *ai = main->Add(new SettingsPage(STR_CONFIG_SETTING_AI)); diff --git a/src/settings_type.h b/src/settings_type.h index 9ba19779db..beb17d5fe0 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -604,6 +604,7 @@ 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 }; /** Default settings for vehicles. */ diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 83198031e9..1f5bdd34ee 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3500,7 +3500,18 @@ static void UpdateStationRating(Station *st) int b = ge->last_speed - 85; if (b >= 0) rating += b >> 2; - byte waittime = ge->time_since_pickup; + uint waittime = ge->time_since_pickup; + if (_settings_game.station.cargo_class_rating_wait_time) { + if (cs->classes & CC_PASSENGERS) { + waittime *= 3; + } else if (cs->classes & CC_REFRIGERATED) { + waittime *= 2; + } else if (cs->classes & (CC_MAIL | CC_ARMOURED | CC_EXPRESS)) { + waittime += (waittime >> 1); + } else if (cs->classes & (CC_BULK | CC_LIQUID)) { + waittime >>= 2; + } + } if (ge->last_vehicle_type == VEH_SHIP) waittime >>= 2; (waittime > 21) || (rating += 25, waittime > 12) || diff --git a/src/table/settings.ini b/src/table/settings.ini index 2f9fa15ddf..44d94eb3d4 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -1421,6 +1421,14 @@ proc = StationCatchmentChanged extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_STATION_CATCHMENT_INC) patxname = ""station_catchment_inc.station.catchment_increase"" +[SDT_BOOL] +base = GameSettings +var = station.cargo_class_rating_wait_time +def = false +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 = order.gradual_loading