diff options
-rw-r--r-- | src/lang/english.txt | 25 | ||||
-rw-r--r-- | src/settings_gui.cpp | 16 | ||||
-rw-r--r-- | src/settings_type.h | 23 | ||||
-rw-r--r-- | src/table/settings.ini | 136 |
4 files changed, 200 insertions, 0 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index 9fef3802d..a43e9b091 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1562,11 +1562,36 @@ STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :Average size of STR_CONFIG_SETTING_MODIFIED_ROAD_REBUILD :Remove absurd road-elements during the road construction: {STRING2} STR_CONFIG_SETTING_MODIFIED_ROAD_REBUILD_HELPTEXT :Remove dead road ends during funded road reconstruction +STR_CONFIG_SETTING_LINKGRAPH_INTERVAL :Update distribution graph every {STRING2} days +STR_CONFIG_SETTING_LINKGRAPH_INTERVAL_HELPTEXT :Time between subsequent recalculations of the link graph. Each recalculation calculates the plans for one component of the graph. That means that a value X for this setting does not mean the whole graph will be updated every X days. Only some component will. The shorter you set it the more CPU time will be necessary to calculate it. The longer you set it the longer it will take until the cargo distribution starts on new routes. +STR_CONFIG_SETTING_LINKGRAPH_TIME :Take {STRING2} days for recalculation of distribution graph +STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT :Time taken for each recalculation of a link graph component. When a recalculation is started, a thread is spawned which is allowed to run for this number of days. The shorter you set this the more likely it is that the thread is not finished when it's supposed to. Then the game stops until it is ("lag"). The longer you set it the longer it takes for the distribution to be updated when routes change. +STR_CONFIG_SETTING_DISTRIBUTION_MANUAL :manual +STR_CONFIG_SETTING_DISTRIBUTION_ASYMMETRIC :asymmetric +STR_CONFIG_SETTING_DISTRIBUTION_SYMMETRIC :symmetric +STR_CONFIG_SETTING_DISTRIBUTION_PAX :Distribution mode for passengers: {STRING2} +STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :"symmetric" means that roughly the same number of passengers will go from a station A to a station B as from B to A. "asymmetric" means that arbitrary numbers of passengers can go in either direction. "manual" means that no automatic distribution will take place for passengers. +STR_CONFIG_SETTING_DISTRIBUTION_MAIL :Distribution mode for mail: {STRING2} +STR_CONFIG_SETTING_DISTRIBUTION_MAIL_HELPTEXT :"symmetric" means that roughly the same amount of mail will be sent from a station A to a station B as from B to A. "asymmetric" means that arbitrary amounts of mail can be sent in either direction. "manual" means that no automatic distribution will take place for mail. +STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED :Distribution mode for the ARMOURED cargo class: {STRING2} +STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT :The ARMOURED cargo class contains valuables in the temperate and subtropical climates or gold in subarctic climate. NewGRFs may change that. "symmetric" means that roughly the same amount of that cargo will be sent from a station A to a station B as from B to A. "asymmetric" means that arbitrary of that cargo can be sent in either direction. "manual" means that no automatic distribution will take place for that cargo. It is recommended to set this to asymmetric or manual when playing subarctic, as banks won't send any gold back to gold mines. For temperate and subtropical you can also choose symmetric as banks will send valuables back to the origin bank of some load of valuables. +STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT :Distribution mode for other cargo classes: {STRING2} +STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT :"symmetric" means that roughly the same amount of cargo will be sent from a station A to a station B as from B to A. "asymmetric" means that arbitrary amounts of cargo can be sent in either direction. "manual" means that no automatic distribution will take place for those cargos. You probably want to set this to either "asymmetric" or manual. +STR_CONFIG_SETTING_LINKGRAPH_ACCURACY :Distribution accuracy: {STRING2} +STR_CONFIG_SETTING_LINKGRAPH_ACCURACY_HELPTEXT :The higher you set this the more CPU time the calculation of the link graph will take. If it takes too long you may notice lag. If you set it to a low value, however, the distribution will be inaccurate, and you may notice cargo not being sent to the places you expect it to go. +STR_CONFIG_SETTING_DEMAND_DISTANCE :Effect of distance on demands: {STRING2} +STR_CONFIG_SETTING_DEMAND_DISTANCE_HELPTEXT :If you set this to a value higher than 0, the distance between the origin station A of some cargo and a possible destination B will have an effect on the amount of cargo sent from A to B. The further away B is from A the less cargo will be sent. The higher you set it, the less cargo will be sent to far away stations and the more cargo will be sent to near stations. +STR_CONFIG_SETTING_DEMAND_SIZE :Amount of returning cargo for symmetric mode: {STRING2} +STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :Setting this to less than 100% makes the symmetric distribution behave more like the asymmetric one. Less cargo will be forcibly sent back if a certain amount is sent to a station. If you set it to 0% the symmetric distribution behaves just like the asymmetric one. +STR_CONFIG_SETTING_SHORT_PATH_SATURATION :Saturation of short paths before using capacious paths: {STRING2} +STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :Frequently there are multiple paths between two given stations. Cargodist will saturate the shortest path first, then use the second shortest path until that is saturated and so on. Saturation is determined by an estimation of capacity and planned usage. Once it has saturated all paths, if there is still demand left, it will overload all paths, prefering the ones with high capacity. Most of the time the algorithm will not estimate the capacity accurately, though. This setting allows you to specify up to which percentage a shorter path must be saturated in the first pass before choosing the next longer one. Set it to less than 100% to avoid overcrowded stations in case of overestimated capacity. + STR_CONFIG_SETTING_GUI :{ORANGE}Interface STR_CONFIG_SETTING_CONSTRUCTION :{ORANGE}Construction STR_CONFIG_SETTING_VEHICLES :{ORANGE}Vehicles STR_CONFIG_SETTING_STATIONS :{ORANGE}Stations STR_CONFIG_SETTING_ECONOMY :{ORANGE}Economy +STR_CONFIG_SETTING_LINKGRAPH :{ORANGE}Cargo Distribution STR_CONFIG_SETTING_AI :{ORANGE}Competitors STR_CONFIG_SETTING_DISPLAY_OPTIONS :{ORANGE}Display options STR_CONFIG_SETTING_INTERACTION :{ORANGE}Interaction diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 182c2f805..92f7d4440 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1602,6 +1602,21 @@ static SettingEntry _settings_economy[] = { /** Economy sub-page */ static SettingsPage _settings_economy_page = {_settings_economy, lengthof(_settings_economy)}; +static SettingEntry _settings_linkgraph[] = { + SettingEntry("linkgraph.recalc_time"), + SettingEntry("linkgraph.recalc_interval"), + SettingEntry("linkgraph.distribution_pax"), + SettingEntry("linkgraph.distribution_mail"), + SettingEntry("linkgraph.distribution_armoured"), + SettingEntry("linkgraph.distribution_default"), + SettingEntry("linkgraph.accuracy"), + SettingEntry("linkgraph.demand_distance"), + SettingEntry("linkgraph.demand_size"), + SettingEntry("linkgraph.short_path_saturation"), +}; +/** Linkgraph sub-page */ +static SettingsPage _settings_linkgraph_page = {_settings_linkgraph, lengthof(_settings_linkgraph)}; + static SettingEntry _settings_ai_npc[] = { SettingEntry("script.settings_profile"), SettingEntry("script.script_max_opcode_till_suspend"), @@ -1698,6 +1713,7 @@ static SettingEntry _settings_main[] = { SettingEntry(&_settings_vehicles_page, STR_CONFIG_SETTING_VEHICLES), SettingEntry(&_settings_stations_page, STR_CONFIG_SETTING_STATIONS), SettingEntry(&_settings_economy_page, STR_CONFIG_SETTING_ECONOMY), + SettingEntry(&_settings_linkgraph_page, STR_CONFIG_SETTING_LINKGRAPH), SettingEntry(&_settings_ai_page, STR_CONFIG_SETTING_AI), }; diff --git a/src/settings_type.h b/src/settings_type.h index e6ac3e015..2e2f594c5 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -17,6 +17,8 @@ #include "transport_type.h" #include "network/core/config.h" #include "company_type.h" +#include "cargotype.h" +#include "linkgraph/linkgraph_type.h" #include "zoom_type.h" #include "openttd.h" @@ -477,6 +479,26 @@ struct EconomySettings { bool infrastructure_maintenance; ///< enable monthly maintenance fee for owner infrastructure }; +struct LinkGraphSettings { + uint16 recalc_time; ///< time (in days) for recalculating each link graph component. + uint16 recalc_interval; ///< time (in days) between subsequent checks for link graphs to be calculated. + DistributionTypeByte distribution_pax; ///< distribution type for passengers + DistributionTypeByte distribution_mail; ///< distribution type for mail + DistributionTypeByte distribution_armoured; ///< distribution type for armoured cargo class + DistributionTypeByte distribution_default; ///< distribution type for all other goods + uint8 accuracy; ///< accuracy when calculating things on the link graph. low accuracy => low running time + uint8 demand_size; ///< influence of supply ("station size") on the demand function + uint8 demand_distance; ///< influence of distance between stations on the demand function + uint8 short_path_saturation; ///< percentage up to which short paths are saturated before saturating most capacious paths + + inline DistributionType GetDistributionType(CargoID cargo) const { + if (IsCargoInClass(cargo, CC_PASSENGERS)) return this->distribution_pax; + if (IsCargoInClass(cargo, CC_MAIL)) return this->distribution_mail; + if (IsCargoInClass(cargo, CC_ARMOURED)) return this->distribution_armoured; + return this->distribution_default; + } +}; + /** Settings related to stations. */ struct StationSettings { bool modified_catchment; ///< different-size catchment areas @@ -517,6 +539,7 @@ struct GameSettings { OrderSettings order; ///< settings related to orders VehicleSettings vehicle; ///< options for vehicles EconomySettings economy; ///< settings to change the economy + LinkGraphSettings linkgraph; ///< settings for link graph calculations StationSettings station; ///< settings related to station management LocaleSettings locale; ///< settings related to used currency/unit system in the current game }; diff --git a/src/table/settings.ini b/src/table/settings.ini index 1b26db9a0..e3deca17b 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -576,6 +576,142 @@ def = true str = STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS strhelp = STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT +; link graph + +[SDT_VAR] +base = GameSettings +var = linkgraph.recalc_interval +type = SLE_UINT16 +from = 183 +def = 4 +min = 2 +max = 32 +interval = 2 +str = STR_CONFIG_SETTING_LINKGRAPH_INTERVAL +strval = STR_JUST_COMMA +strhelp = STR_CONFIG_SETTING_LINKGRAPH_INTERVAL_HELPTEXT + +[SDT_VAR] +base = GameSettings +var = linkgraph.recalc_time +type = SLE_UINT16 +from = 183 +def = 16 +min = 1 +max = 4096 +interval = 1 +str = STR_CONFIG_SETTING_LINKGRAPH_TIME +strval = STR_JUST_COMMA +strhelp = STR_CONFIG_SETTING_LINKGRAPH_TIME_HELPTEXT + +[SDT_VAR] +base = GameSettings +var = linkgraph.distribution_pax +type = SLE_UINT8 +from = 183 +guiflags = SGF_MULTISTRING +def = DT_MANUAL +min = DT_MIN +max = DT_MAX +interval = 1 +str = STR_CONFIG_SETTING_DISTRIBUTION_PAX +strval = STR_CONFIG_SETTING_DISTRIBUTION_MANUAL +strhelp = STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT + +[SDT_VAR] +base = GameSettings +var = linkgraph.distribution_mail +type = SLE_UINT8 +from = 183 +guiflags = SGF_MULTISTRING +def = DT_MANUAL +min = DT_MIN +max = DT_MAX +interval = 1 +str = STR_CONFIG_SETTING_DISTRIBUTION_MAIL +strval = STR_CONFIG_SETTING_DISTRIBUTION_MANUAL +strhelp = STR_CONFIG_SETTING_DISTRIBUTION_MAIL_HELPTEXT + +[SDT_VAR] +base = GameSettings +var = linkgraph.distribution_armoured +type = SLE_UINT8 +from = 183 +guiflags = SGF_MULTISTRING +def = DT_MANUAL +min = DT_MIN +max = DT_MAX +interval = 1 +str = STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED +strval = STR_CONFIG_SETTING_DISTRIBUTION_MANUAL +strhelp = STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT + +[SDT_VAR] +base = GameSettings +var = linkgraph.distribution_default +type = SLE_UINT8 +from = 183 +guiflags = SGF_MULTISTRING +def = DT_MANUAL +min = DT_BEGIN +max = DT_MAX_NONSYMMETRIC +interval = 1 +str = STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT +strval = STR_CONFIG_SETTING_DISTRIBUTION_MANUAL +strhelp = STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT + +[SDT_VAR] +base = GameSettings +var = linkgraph.accuracy +type = SLE_UINT8 +from = 183 +def = 16 +min = 2 +max = 64 +interval = 1 +str = STR_CONFIG_SETTING_LINKGRAPH_ACCURACY +strval = STR_JUST_COMMA +strhelp = STR_CONFIG_SETTING_LINKGRAPH_ACCURACY_HELPTEXT + +[SDT_VAR] +base = GameSettings +var = linkgraph.demand_distance +type = SLE_UINT8 +from = 183 +def = 100 +min = 0 +max = 255 +interval = 5 +str = STR_CONFIG_SETTING_DEMAND_DISTANCE +strval = STR_CONFIG_SETTING_PERCENTAGE +strhelp = STR_CONFIG_SETTING_DEMAND_DISTANCE_HELPTEXT + +[SDT_VAR] +base = GameSettings +var = linkgraph.demand_size +type = SLE_UINT8 +from = 183 +def = 100 +min = 0 +max = 100 +interval = 5 +str = STR_CONFIG_SETTING_DEMAND_SIZE +strval = STR_CONFIG_SETTING_PERCENTAGE +strhelp = STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT + +[SDT_VAR] +base = GameSettings +var = linkgraph.short_path_saturation +type = SLE_UINT8 +from = 183 +def = 80 +min = 0 +max = 250 +interval = 5 +str = STR_CONFIG_SETTING_SHORT_PATH_SATURATION +strval = STR_CONFIG_SETTING_PERCENTAGE +strhelp = STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT + ; Vehicles [SDT_VAR] |