Commit Graph

70 Commits

Author SHA1 Message Date
rubidium42
f35e6c1c7f Codechange: use C-style strings instread of std::string in the SettingDesc constructor
This as using std::string causes much more variables to be tracked, potentially causing problemes for certain compilers in certain situations
2021-06-26 20:28:34 +02:00
rubidium42
bf500c39c9 Codechange: make the name of SettingDesc a std::string 2021-06-13 10:26:58 +02:00
rubidium42
ca9c50607e Codechange: use StrStartsWith/StrEndsWith when finding settings 2021-06-13 10:26:58 +02:00
Patric Stout
648ee88a02 Codechange: merge guiflags and flags in settings .ini files
It was rather confusing which one was for what, especially as some
SaveLoad flags were settings-only. Clean up this mess a bit by
having only Setting flags.
2021-06-06 21:45:01 +02:00
Patric Stout
feb2ddbefa
Codechange: rename SettingGuiFlag to SettingFlag (#9332)
It is a lovely organicly grown enum, where it started off with
GUI-only flags, and after that a few flags got added that can be
considered GUI-only (the GUI disables/enables based on them), to
only have flags added that has nothing to do with the GUI.

So be less confusing, and rename them to what they do.

Additionally, I took this opportunity to rename 0ISDISABLED to
reflect what it really does.
2021-06-03 21:18:29 +02:00
Patric Stout
0c96884700
Codechange: add a wrapper function to find all settings based on prefix (#9312) 2021-05-30 10:55:52 +02:00
Patric Stout
d70fb74ac6
Codechange: use setting name instead of index for CmdChange(Company)Setting (#9306)
This is mostly done as there are now constraints on settings.ini you might not
expected. For example, conditional settings always have to come last, as otherwise
they would influence the index.
2021-05-29 23:27:01 +02:00
rubidium42
08308d808c Codechange: use separate pre and post callbacks for int settings 2021-05-29 10:07:30 +02:00
rubidium42
e2f5d9e561 Codechange: use separate pre and post callbacks for string settings 2021-05-29 10:07:30 +02:00
rubidium42
ea9715d970 Codechange: split Write_ValidateSetting to get separate functions for making ints valid and writing ints 2021-05-29 10:07:30 +02:00
rubidium42
208952f2ba Codechange: split Write_ValidateSetting to get separate functions for making strings valid and writing strings 2021-05-29 10:07:30 +02:00
rubidium42
8372c679e3 Codechange: add helper functions to read an int setting value 2021-05-27 18:49:43 +02:00
rubidium42
86c9ef8134 Codechange: remove SettingDescType in lieu of the actual classes 2021-05-27 18:49:43 +02:00
rubidium42
e666a962b1 Codechange: let OneOfMany and ManyOfMany be their own classes as well 2021-05-27 18:49:43 +02:00
rubidium42
860003458f Codechange: make BoolSettingDesc its own sub class 2021-05-27 18:49:43 +02:00
rubidium42
72ec81325b Cleanup: remove unneeded temporary variables and casts 2021-05-27 18:49:43 +02:00
rubidium42
0d6597a9e6 Codechange: move bits of SettingDesc down to the appropriate sub classes
And by doing so remove the hack where ints were put into pointers so "def" could either be an int or a string
2021-05-27 18:49:43 +02:00
rubidium42
f6723b53da Codechange: make parsing of IniItems overridable functions of SettingDesc 2021-05-27 18:49:43 +02:00
rubidium42
1f8ff0e4f9 Codechange: make Write_ValidateSetting a function of StringSettingDesc 2021-05-27 18:49:43 +02:00
rubidium42
be28c95b30 Codechange: make Write_ValidateSetting a function of IntSettingDesc 2021-05-27 18:49:43 +02:00
rubidium42
c3cd4a683d Codechange: make formatting of values into strings a method of SettingDesc 2021-05-27 18:49:43 +02:00
rubidium42
d8125fa46e Codechange: make sub classes of SettingDesc for the different types of settings 2021-05-27 18:49:43 +02:00
rubidium42
91b3d697c5 Codechange: make SettingDesc an instance in the setting table to allow for sub classes 2021-05-27 18:49:43 +02:00
rubidium42
3bb6ce8827 Codechange: use initializer_lists for the settings tables
Not using vectors as those require copying from the initializer list and that
makes unique_ptrs to the actual SettingDesc objects later impossible.
2021-05-27 18:49:43 +02:00
rubidium42
425d50372f Codechange: let SettingDesc extend SettingDescBase 2021-05-27 18:49:43 +02:00
rubidium42
ac99a38175 Cleanup: remove and/or fix some confusing comments
The comments for SettingDescType; it is a byte, so not 4 bytes and since it is not a flag there are about 250 other possibilities left instead of 9.
SettingGuiFlag is uint16 so has 2 bytes allocated.
SettingDescGlobVarList and related comments imply that global vars cannot be used elsewhere, but they are used for settings just fine. Even then the type is not used anywhere else but the definition of the table.
2021-05-27 18:49:43 +02:00
rubidium42
8ffb4122df Codechange: just pass the SettingDesc to SetSettingValue and remove distinction between (non)company 2021-05-27 18:49:43 +02:00
rubidium42
0f062b3882 Codechange: clean up C-string support from settings 2021-05-13 23:13:17 +02:00
Patric Stout
cafe4eed6e Feature: setting to indicate snow coverage for arctic climate (replaces snow line height)
Setting the snow coverage (in % of the map) makes a lot more sense
to the human, while still allowing the niche player to set (by
finding the correct %) a snow line height they like. This makes for
easier defaults, as it decoupled terrain height from amount of snow.

Maps can never be 100% snow, as we do not have sprites for coastal
tiles.

Internally, this calculates the best snow line height to approach
this coverage as close as possible.
2021-03-26 12:22:32 +01:00
Michael Lutz
00c66e7096 Codechange: Allow early-load settings that are not misc settings. 2021-02-17 21:01:21 +01:00
Michael Lutz
a49fdb7ebb Codechange: Store base set related texts in std::strings. 2020-05-21 20:02:34 +02:00
S. D. Cloudt
13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Charles Pigott
644f4c3547 Codechange: Set size of SettingGuiFlag & SettingDescType enums, and use them properly 2019-04-29 17:40:22 +01:00
planetmaker
c24374f99c (svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow) 2013-01-08 22:46:42 +00:00
frosch
c4c3d00578 (svn r24862) -Add: Settings type filter to adv. settings GUI. 2012-12-26 17:47:02 +00:00
frosch
0efd29b71b (svn r24860) -Codechange: Add SettingDesc::GetType(). 2012-12-26 17:43:35 +00:00
frosch
22dc45738d (svn r24787) -Fix: Unify checks for editability of settings. 2012-12-05 19:35:09 +00:00
frosch
69a62452be (svn r24671) -Feature [FS#5355]: Add basic/advanced/expert filters to adv. settings GUI. (Eagle_rainbow) 2012-11-08 10:04:00 +00:00
alberth
1d58838a97 (svn r24234) -Add: Add help-string infrastructure to the ini files 2012-05-12 10:09:00 +00:00
alberth
34a11d4b8d (svn r24233) -Codechange: Rename 'val_str' to 'str_val' to better match with 'strval' in the ini files. 2012-05-12 10:07:18 +00:00
alberth
88224d001d (svn r24210) -Feature: Split the renew-months setting text in two string values (one before life time and one after). 2012-05-06 15:03:45 +00:00
alberth
8c585e5ad6 (svn r24209) -Cleanup: Remove now unused SGF_NOCOMMA value. 2012-05-06 15:00:13 +00:00
rubidium
e40eb8177a (svn r23735) -Codechange: remove ~50 includes from headers that weren't needed 2012-01-03 20:26:05 +00:00
frosch
d29def43b0 (svn r22626) -Fix [FS#4622]: Also initialise _old_vds with newgame settings; TTD savegames do not contain these settings. 2011-07-03 10:59:25 +00:00
frosch
615e435677 (svn r22522) -Fix (r22489): (size_t)(uint32)(-1) != (size_t)-1 2011-05-29 18:35:31 +00:00
alberth
9fe65f93fe (svn r22210) -Add: Add a variable for the value strings in the settings tables. 2011-03-06 15:51:44 +00:00
alberth
f65a9a5515 (svn r21593) -Codechange: endif comment correcttions. 2010-12-22 10:50:32 +00:00
alberth
997551c599 (svn r21467) -Doc: Add a few doxygen comments to config file settings code. 2010-12-11 15:14:28 +00:00
frosch
4bd32799f1 (svn r20286) -Codechange: Unify end of doxygen comments. 2010-08-01 19:44:49 +00:00
frosch
ed4f806f1d (svn r20283) -Codechange: Unify start of doygen comments. 2010-08-01 19:22:34 +00:00