Rubidium
d31a535c87
Cleanup: remove some unneeded c_str() calls
2021-06-15 06:13:00 +02:00
Patric Stout
4600d289b5
Codechange: ability to store structs and list of structs in savegames
...
The commits following this will use this new functionality.
Currently, a few places do this manually. This has as drawback that
the Save() and Load() code need to be in sync, and that any change
can result in (old) savegames no longer loading. In general, it is
annoying code to maintain.
By putting everything in a description table, and use that for
both Save() and Load(), it becomes easier to see what is going on,
and hopefully less likely for people to make mistakes.
2021-06-14 21:58:05 +02:00
rubidium42
eb6cdadc4d
Codechange: replace IConsolePrintF with IConsolePrint and fmt formatting
...
Also make some strings more consistent with the rest of the console strings.
2021-06-13 15:25:31 +02:00
rubidium42
efd4ba4797
Change: unify the style of console error messages and convert to fmt
...
Always start with a capital, do not add "ERROR: " in front of it.
2021-06-13 15:25:31 +02:00
rubidium42
55a11710a6
Codechange: convert printf DEBUG statements to fmt Debug statements
2021-06-13 12:45:45 +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
1e564b333f
Codechange: make [Save|Load]Settings() behave more like other Save/Load code ( #9335 )
...
Prepare the full description and send it to SlObject. This does
require some code to be able to read to a SLE_VAR_NULL, like strings
etc, as there is no way to know their length beforehand.
2021-06-07 23:03:12 +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
264991dfa5
Codechange: move SLF_NO_NETWORK_SYNC into settings
...
It is a settings-only flag, so don't pollute SaveLoad code with it.
2021-06-06 21:45:01 +02:00
Patric Stout
414e12d26b
Codechange: move SLF_NOT_IN_SAVE into settings
...
It is a settings-only flag, so don't pollute SaveLoad code with it.
2021-06-06 21:45:01 +02:00
Patric Stout
7572603c9d
Codechange: remove the unused SLF_HEX flag
2021-06-06 21:45:01 +02:00
glx22
c27afdf3f6
Codechange: Remove FOR_ALL_CHUNK_HANDLERS
...
Co-Authored-By: Patric Stout <truebrain@openttd.org>
2021-06-06 19:35:06 +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
9fff00ba20
Codechange: C++-ify lists for SaveLoad ( #9323 )
...
Basically, this changes "SaveLoad *" to either:
1) "SaveLoadTable" if a list of SaveLoads was meant
2) "SaveLoad &" if a single entry was meant
As added bonus, this removes SL_END / SLE_END / SLEG_END. This
also adds core/span.hpp, a "std::span"-lite.
2021-05-31 22:26:44 +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
e9e4588db1
Codechange: use setting name instead of index for HandleOldDiffCustom() ( #9311 )
2021-05-30 10:40:59 +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
glx22
5799402f7a
Codechange: Rename window related DeleteXXX to match new behaviour
2021-05-29 21:08:25 +02:00
rubidium42
ef991b1772
Codechange: [Network] Use std::string in CommandPacket
2021-05-29 19:02:18 +02:00
rubidium42
2e136285e1
Codechange: move from C-string to std::string for DoCommand
2021-05-29 19:02:18 +02:00
Patric Stout
ca9a7df752
Codechange: rename str_validate to StrMakeValid(InPlace) ( #9304 )
...
This to be more explicit the function changes the value, and not
returns yes/no.
2021-05-29 11:21:38 +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
024e584904
Cleanup: use (config) formatting for console settings functions
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
91b3d697c5
Codechange: make SettingDesc an instance in the setting table to allow for sub classes
2021-05-27 18:49:43 +02:00
rubidium42
cf6b91f30f
Codechange: do not use SettingDescBase directly when not needed
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
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
rubidium42
a032714dc4
Codechange: move script settings to std::string
2021-05-13 23:13:17 +02:00
rubidium42
c73d64adf9
Codechange: move passwords in settings to std::string
2021-05-13 23:13:17 +02:00
rubidium42
f219354f89
Change: further support for std::string in settings
2021-05-13 23:13:17 +02:00
rubidium42
6bca9e090d
Codechange: add SetDParamStr that accepts std::string&
2021-05-06 21:45:36 +02:00
rubidium42
e7581fd42d
Change: [Network] Update server's NetworkServerGameInfo only when needed
...
Split the updating in a "static" version that only needs to be called when a new map is loaded or some settings are changed, and a "dynamic" version that updates everything that changes regularly such as the current game date or the number of spectators.
2021-05-05 21:01:23 +02:00
Peter Nelson
4791ff2862
Fix: Recalculate padding and minimum sizes when GUI or Font zoom is changed.
2021-04-30 17:08:15 +01:00
rubidium42
31c87ba908
Fix: truncating strings in settings could leave invalid Utf8 characters
2021-04-27 19:41:51 +02:00