Commit Graph

550 Commits

Author SHA1 Message Date
MasonGulu 0be27778af
Add: alternative setting for right-click close window option to exclude pinned windows (#10204) 2023-07-19 23:24:22 +02:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Patric Stout 4f4810dc28 Fix: store autosave settings under the new names 2023-07-19 13:17:50 +02:00
Patric Stout 790c1b1b02 Codechange: refactor setting conversions and make sure it only happens once
By forcing it only happens once, the first time you upgrade to
a newer client, means you are free to jump between older and newer
versions after that. As they will not resync, the newer setting
can take on any of the (newer) values, without breaking the old
client. And when going to an old client and back, it doesn't
change it back to the converted value anymore.
2023-07-19 13:17:50 +02:00
Patric Stout ece50d5a1d Codechange: use BoolSettingDesc to parse settings in conversion code 2023-07-19 13:17:50 +02:00
Jonathan G Rennison 864d3c9c16
Fix: CMD_CHANGE_SETTING did not reject SF_NO_NETWORK_SYNC settings (#11009) 2023-06-14 19:44:10 +02:00
PeterN 64d6ad50f9
Codechange: Split GetItem with GetOrCreateItem. (#10952)
`IniGroup::GetItem()` returns nullptr if the item does not exist, but does not if the create parameter is set to true. Resolve CodeQL warnings with `GetOrCreateItem()` which returns a reference to the item instead.
2023-06-05 18:29:52 +00:00
Rubidium 4fdde00e25 Codechange: use std::string to create the GRF parameter list 2023-05-25 05:43:00 +02:00
Rubidium f4b0ac2bd4 Codechange: use std::string for formatting settings 2023-05-24 22:42:01 +02:00
Peter Nelson 6b87fe6540 Codechange: Use std::array for GRF(File|Config) parameters.
This simplifies comparison, copying and assignment operations.
2023-05-19 16:53:56 +01:00
Rubidium acec34a0fe Cleanup: remove MD5SumToString in lieu of FormatArrayAsHex 2023-05-19 11:24:44 +02:00
Rubidium d9a04ba446 Codechange: make the MD5 hash/digest/checksum variables a std::array 2023-05-19 11:24:44 +02:00
Rubidium 9f2fc860ad Codechange: use std::optional<std::string> for changing the script over char * 2023-05-14 22:54:10 +02:00
Rubidium 0fd9eb0faa Codechange: use std::string for script info/library finding 2023-05-14 22:54:10 +02:00
Rubidium a312a6c1b2 Codechange: make md5sumToString std::string compatible 2023-05-04 23:23:32 +02:00
Patric Stout c6c3d0e6fa
Fix: no_http_content_downloads and use_relay_service as private settings (#10762)
Basically, we don't need to know those values when people send in
crash reports.
2023-05-04 22:46:02 +02:00
Tyler Trahan 6501f84b4a
Codechange: Move calendar date functions inside TimerGameCalendar (#10753) 2023-05-04 13:14:12 +00:00
Peter Nelson 00bf42353a Codechange: Place gamelog into its own class, along with internal data.
Data is now stored in vectors to avoid manual memory management and
passing lengths around.
2023-05-02 19:47:55 +01:00
Charles Pigott 80bd5ad727
Codechange: Use std::strto* variants everywhere (#10720) 2023-04-26 12:56:14 +01:00
Charles Pigott b282664242 Codechange: Replace all usages of alloca/AllocaM with more modern/less discouraged alternatives 2023-04-15 16:57:00 +01:00
Tyler Trahan 646a7e625b
Change: Use seconds for Linkgraph update settings (#10610) 2023-04-14 22:49:12 +02:00
Rubidium 4e65ec1dc4 Codechange: do not declare functions in blocks 2023-01-29 20:28:45 +01:00
Jonathan G Rennison 7c3c92f8b8
Fix #10155: SyncCompanySettings sending old instead of new setting values (#10158) 2022-11-12 17:24:31 +00:00
Jonathan G Rennison 3b3c9c1c3a
Fix #10129: Use after free in GRFLoadConfig invalid GRF error path (#10130) 2022-11-05 15:17:18 +01:00
Loïc Guilloux d62c5667cf
Fix #9766: Don't write uninitialised data in config file (#9767) 2022-01-04 22:12:05 +01:00
Michael Lutz d85348b1d1 Codechange: Template the command callback function type to allow unpacked arguments. 2021-12-16 22:28:32 +01:00
Michael Lutz 13528bfcd0 Codechange: Un-bitstuff all remaining commands. 2021-12-16 22:28:32 +01:00
Michael Lutz ccefa76a46 Codechange: Template DoCommandPInternal. 2021-12-16 22:28:32 +01:00
Michael Lutz 0f64ee5ce1 Codechange: Template DoCommandP to automagically reflect the parameters of the command proc.
When finished, this will allow each command handler to take individually
different parameters, obliviating the need for bit-packing.
2021-12-16 22:28:32 +01:00
Michael Lutz 7048e1522f Codechange: Move flags in CommandProc in front of the command arguments. 2021-12-16 22:28:32 +01:00
Michael Lutz 33ca4f2b99 Codechange: Let the compile generate the master command table out of templated command traits.
This is using a non-intrusive type-traits like templated system, which
allows compile-time validation that the command table and the command
enum match up.
2021-12-16 22:28:32 +01:00
Michael Lutz a38bbefe1b Codechange: Untangle command code, flags and error string for DoCommand*. 2021-12-16 22:28:32 +01:00
Michael Lutz 549caca39c Codechange: Move command arguments to the back of the networked command function calls. 2021-12-16 22:28:32 +01:00
Rubidium 92559e6f3a Fix #9388: thread unsafe use of NetworkAdminConsole/IConsolePrint 2021-09-01 22:40:44 +02:00
Loïc Guilloux 8d2162ba2d
Fix b6a116a: convert server_advertise to server_game_type in config file (#9515) 2021-08-28 14:41:07 +02:00
Rubidium c71f06e59b Feature: parse the console settings the same way as config settings
Now you can use things like `set server_game_type public` instead of having to
guess the number, which would not be written into the configuration file nor
would it be shown when doing `set server_game_type`.
2021-07-11 23:11:05 +02:00
Rubidium 178ea3196b Remove: includes to network/core/config.h from headers when only three cpp files need it 2021-07-11 22:13:59 +02:00
Rubidium f6955a304c Fix: ensure no more than the allowed number of NewGRFs are loaded from the configuration 2021-07-11 11:20:07 +02:00
Rubidium 01139d3368 Codechange: access the name of a setting via an accessor function 2021-07-09 22:53:30 +02:00
glx22 89ab8b79a5 Codechange: Remove FOR_EACH_SET_BIT 2021-07-09 21:36:09 +02:00
Patric Stout 8f5d0ecde3
Codechange: split settings.ini over several files (#9421)
This reduced the load on compilers, as currently for example MacOS
doesn't like the huge settings-tables.

Additionally, nobody can find settings, as the list is massive and
unordered. By splitting it, it becomes a little bit more sensible.
2021-07-09 21:16:03 +02:00
Rubidium 7e7a4aad72 Codechange: split off the settings saveload code from the main settings handling logic 2021-07-06 21:32:47 +02:00
rubidium42 25ca6a75bc Codechange: split off the settings table and all the callbacks from the main settings handling logic 2021-07-06 21:32:47 +02:00
glx22 b4aedc8bee Codechange: ensure xxx_setting_tables are initialised after their content 2021-07-06 21:32:47 +02:00
Patric Stout cdb3dd0493 Add: store headers for most savegame chunks
When a header is added, the chunk changes from CH_ARRAY type to
CH_TABLE type.
2021-07-02 22:21:58 +02:00
Patric Stout 7dd5fd6ed4 Feature: framework to make savegames self-descriptive
We won't be able to make it fully self-descriptive (looking at you
MAP-chunks), but anything else can. With this framework, we can
add headers for each chunk explaining how each chunk looks like
in detail.

They also will all be tables, making it a lot easier to read in
external tooling, and opening the way to consider a database
(like SQLite) to use as savegame format.

Lastly, with the headers in the savegame, you can freely add
fields without needing a savegame version bump; older versions
of OpenTTD will simply ignore the new field. This also means
we can remove all the SLE_CONDNULL, as they are irrelevant.

The next few commits will start using this framework.
2021-07-02 22:21:58 +02:00
Patric Stout 75b6051b7a Change: move sensitive information to secrets.cfg and private information to private.cfg
We often ask people for their openttd.cfg, which now includes their
passwords, usernames, etc. It is easy for people to overlook this,
unwillingly sharing information they shouldn't.

By splitting this information over either private.cfg or secrets.cfg,
we make it more obvious they shouldn't be sharing those files, and
hint to what is inside them.
2021-07-02 14:30:14 +02:00
Patric Stout 4f3bf84af4 Codechange: simplify SaveVersionInConfig()
Clearly someone really wanted to generalize the function, but
in reality it makes it a lot longer than needed. Let's keep it
simple.
2021-07-02 14:30:14 +02:00
Patric Stout 66dc0ce196 Codechange: C++-ify the usage of IniFile in settings.cpp
Instead of creating the object on heap and use a pointer, create
the object on stack and use a guaranteed-not-null pointer.
The size of IniFile doesn't warrent the forcing to heap.

Additionally, use a subclass instead of a function to do some
initial bookkeeping on an IniFile meant to read a configuration.
2021-07-02 14:30:14 +02:00
Patric Stout a42251fc72 Codechange: move network-related settings out of settings.ini
This to prepare the code to split up network-related settings
into private / secrets / generic.
2021-07-02 14:30:14 +02:00