diff options
author | Patric Stout <truebrain@openttd.org> | 2021-03-01 13:12:17 +0100 |
---|---|---|
committer | Patric Stout <github@truebrain.nl> | 2021-03-01 23:17:47 +0100 |
commit | 74aa934441351334e40d8963900b8a2fbc9bc9cd (patch) | |
tree | 1257efebb69111b35c5026d59c0504088faff0d8 /src/table/currency_settings.ini | |
parent | d7a70c67bacef7453ae56e9136c9c16e4b19c314 (diff) | |
download | openttd-74aa934441351334e40d8963900b8a2fbc9bc9cd.tar.xz |
Codechange: validate that "max" value of settings fit in their storage
This is an easy mistake to make, so protect us against making such
mistakes, by validating it doesn't happen.
Diffstat (limited to 'src/table/currency_settings.ini')
-rw-r--r-- | src/table/currency_settings.ini | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/table/currency_settings.ini b/src/table/currency_settings.ini index 7ff879964..c242c83a8 100644 --- a/src/table/currency_settings.ini +++ b/src/table/currency_settings.ini @@ -14,6 +14,9 @@ SDT_CHR = SDT_CHR($base, $var, $flags, $guiflags, $def, SDT_STR = SDT_STR($base, $var, $type, $flags, $guiflags, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup), SDT_END = SDT_END() +[validation] +SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for $base.$var exceeds storage size"); + [defaults] flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC guiflags = SGF_NONE |