diff --git a/src/lang/english.txt b/src/lang/english.txt index 797fd7db60..36f75ff67e 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2061,6 +2061,7 @@ STR_CONFIG_SETTING_DISTRIBUTION_PER_CARGO :Distribution mo STR_CONFIG_SETTING_DISTRIBUTION_PER_CARGO_PARAM :Distribution mode override for {STRING}: {STRING2} STR_CONFIG_SETTING_DISTRIBUTION_PER_CARGO_HELPTEXT :"(default)" means that the distribution mode is the default for the class of this cargo. "symmetric" means that roughly the same number of cargo will go 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 this cargo. STR_CONFIG_SETTING_DISTRIBUTION_PER_CARGO_DEFAULT :(default) +STR_CONFIG_SETTING_DISTRIBUTION_HELPTEXT_EXTRA :{STRING}{}"asymmetric (equal distribution)" means that cargo will be distributed such that each accepting station receives approximately the same amount of cargo in total. "asymmetric (nearest)" means that cargo is sent to whichever accepting station is nearest. 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} diff --git a/src/settings.cpp b/src/settings.cpp index da8c80c844..ca71b51a7d 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1881,6 +1881,19 @@ static int64 LinkGraphDistModeXrefChillPP(int64 val) /* Begin - GUI callbacks */ +static bool LinkGraphDistributionSettingGUI(SettingOnGuiCtrlData &data) +{ + switch (data.type) { + case SOGCT_DESCRIPTION_TEXT: + SetDParam(0, data.text); + data.text = STR_CONFIG_SETTING_DISTRIBUTION_HELPTEXT_EXTRA; + return true; + + default: + return false; + } +} + /* End - GUI callbacks */ /** diff --git a/src/table/settings.ini b/src/table/settings.ini index b08753b928..38ab9196de 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -77,6 +77,8 @@ static bool CheckSharingRoad(int32 p1); static bool CheckSharingWater(int32 p1); static bool CheckSharingAir(int32 p1); +static bool LinkGraphDistributionSettingGUI(SettingOnGuiCtrlData &data); + /* End - Callback Functions for the various settings */ /* Begin - GUI order callbacks */ @@ -160,7 +162,7 @@ SDT_NULL = SDT_NULL($length, $from, $to, $extver), SDT_XREF = SDT_XREF( $from, $to, $extver, $xref, $xrefcvt), SDT_END = SDT_END() -SDT_LINKGRAPH_PER_CARGO = SDT_ENUM(GameSettings, linkgraph.distribution_per_cargo[$linkgraph_cargo], SLE_UINT8, $flags | SLF_NOT_IN_CONFIG, $guiflags | SGF_NO_NEWGAME, DT_PER_CARGO_DEFAULT, STR_CONFIG_SETTING_DISTRIBUTION_PER_CARGO, STR_CONFIG_SETTING_DISTRIBUTION_PER_CARGO_HELPTEXT, $proc, $guiproc, $from, $to, SC_EXPERT, false, SlXvFeatureTest(XSLFTO_AND, XSLFI_LINKGRAPH_MODES), nullptr, _linkgraph_mode_per_cargo), +SDT_LINKGRAPH_PER_CARGO = SDT_ENUM(GameSettings, linkgraph.distribution_per_cargo[$linkgraph_cargo], SLE_UINT8, $flags | SLF_NOT_IN_CONFIG, $guiflags | SGF_NO_NEWGAME, DT_PER_CARGO_DEFAULT, STR_CONFIG_SETTING_DISTRIBUTION_PER_CARGO, STR_CONFIG_SETTING_DISTRIBUTION_PER_CARGO_HELPTEXT, $proc, LinkGraphDistributionSettingGUI, $from, $to, SC_EXPERT, false, SlXvFeatureTest(XSLFTO_AND, XSLFI_LINKGRAPH_MODES), nullptr, _linkgraph_mode_per_cargo), [validation] SDTG_VAR = static_assert($max <= MAX_$type, "Maximum value for $var exceeds storage size"); @@ -1007,6 +1009,7 @@ def = DT_MANUAL enumlist = _linkgraph_mode_symmetric str = STR_CONFIG_SETTING_DISTRIBUTION_PAX strhelp = STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT +guiproc = LinkGraphDistributionSettingGUI [SDT_ENUM] base = GameSettings @@ -1017,6 +1020,7 @@ def = DT_MANUAL enumlist = _linkgraph_mode_symmetric str = STR_CONFIG_SETTING_DISTRIBUTION_MAIL strhelp = STR_CONFIG_SETTING_DISTRIBUTION_MAIL_HELPTEXT +guiproc = LinkGraphDistributionSettingGUI [SDT_ENUM] base = GameSettings @@ -1027,6 +1031,7 @@ def = DT_MANUAL enumlist = _linkgraph_mode_symmetric str = STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED strhelp = STR_CONFIG_SETTING_DISTRIBUTION_ARMOURED_HELPTEXT +guiproc = LinkGraphDistributionSettingGUI [SDT_ENUM] base = GameSettings @@ -1037,6 +1042,7 @@ def = DT_MANUAL enumlist = _linkgraph_mode_asymmetric str = STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT strhelp = STR_CONFIG_SETTING_DISTRIBUTION_DEFAULT_HELPTEXT +guiproc = LinkGraphDistributionSettingGUI [SDT_LINKGRAPH_PER_CARGO] linkgraph_cargo = 0