summaryrefslogtreecommitdiff
path: root/src/table/company_settings.ini
diff options
context:
space:
mode:
Diffstat (limited to 'src/table/company_settings.ini')
-rw-r--r--src/table/company_settings.ini30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/table/company_settings.ini b/src/table/company_settings.ini
index eecebb40e..019c26dd9 100644
--- a/src/table/company_settings.ini
+++ b/src/table/company_settings.ini
@@ -5,19 +5,16 @@
;
[pre-amble]
-static bool CheckInterval(int32 p1);
-static bool InvalidateDetailsWindow(int32 p1);
-static bool UpdateIntervalTrains(int32 p1);
-static bool UpdateIntervalRoadVeh(int32 p1);
-static bool UpdateIntervalShips(int32 p1);
-static bool UpdateIntervalAircraft(int32 p1);
+static void UpdateServiceInterval(int32 new_value);
+static bool CanUpdateServiceInterval(VehicleType type, int32 &new_value);
+static void UpdateServiceInterval(VehicleType type, int32 new_value);
static const SettingTable _company_settings{
[post-amble]
};
[templates]
-SDT_BOOL = SDT_BOOL($base, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
-SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup),
+SDT_BOOL = SDT_BOOL($base, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
+SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $pre_cb, $post_cb, $from, $to, $cat, $extra, $startup),
[validation]
SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for $base.$var exceeds storage size");
@@ -29,7 +26,8 @@ interval = 0
str = STR_NULL
strhelp = STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT
strval = STR_NULL
-proc = nullptr
+pre_cb = nullptr
+post_cb = nullptr
load = nullptr
from = SL_MIN_VERSION
to = SL_MAX_VERSION
@@ -82,7 +80,7 @@ var = vehicle.servint_ispercent
def = false
str = STR_CONFIG_SETTING_SERVINT_ISPERCENT
strhelp = STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT
-proc = CheckInterval
+post_cb = UpdateServiceInterval
[SDT_VAR]
base = CompanySettings
@@ -95,7 +93,8 @@ max = 800
str = STR_CONFIG_SETTING_SERVINT_TRAINS
strhelp = STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT
strval = STR_CONFIG_SETTING_SERVINT_VALUE
-proc = UpdateIntervalTrains
+pre_cb = [](auto new_value) { return CanUpdateServiceInterval(VEH_TRAIN, new_value); }
+post_cb = [](auto new_value) { UpdateServiceInterval(VEH_TRAIN, new_value); }
[SDT_VAR]
base = CompanySettings
@@ -108,7 +107,8 @@ max = 800
str = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES
strhelp = STR_CONFIG_SETTING_SERVINT_ROAD_VEHICLES_HELPTEXT
strval = STR_CONFIG_SETTING_SERVINT_VALUE
-proc = UpdateIntervalRoadVeh
+pre_cb = [](auto new_value) { return CanUpdateServiceInterval(VEH_ROAD, new_value); }
+post_cb = [](auto new_value) { UpdateServiceInterval(VEH_ROAD, new_value); }
[SDT_VAR]
base = CompanySettings
@@ -121,7 +121,8 @@ max = 800
str = STR_CONFIG_SETTING_SERVINT_SHIPS
strhelp = STR_CONFIG_SETTING_SERVINT_SHIPS_HELPTEXT
strval = STR_CONFIG_SETTING_SERVINT_VALUE
-proc = UpdateIntervalShips
+pre_cb = [](auto new_value) { return CanUpdateServiceInterval(VEH_SHIP, new_value); }
+post_cb = [](auto new_value) { UpdateServiceInterval(VEH_SHIP, new_value); }
[SDT_VAR]
base = CompanySettings
@@ -134,4 +135,5 @@ max = 800
str = STR_CONFIG_SETTING_SERVINT_AIRCRAFT
strhelp = STR_CONFIG_SETTING_SERVINT_AIRCRAFT_HELPTEXT
strval = STR_CONFIG_SETTING_SERVINT_VALUE
-proc = UpdateIntervalAircraft
+pre_cb = [](auto new_value) { return CanUpdateServiceInterval(VEH_AIRCRAFT, new_value); }
+post_cb = [](auto new_value) { UpdateServiceInterval(VEH_AIRCRAFT, new_value); }