Commit Graph

583 Commits

Author SHA1 Message Date
Rubidium
c544a2be0a Fix: do not use lengthof() for non C-style arrays 2024-04-06 07:21:31 +02:00
Peter Nelson
2047c27445 Codechange: Move drop down list item definitions to separate header.
This reduces the scope of the definitions which are no longer needed to create the common lists.
2024-04-01 22:33:16 +01:00
Peter Nelson
8d312b305b
Codechange: Replace currency macros with functions. (#12396) 2024-03-29 14:49:48 +00:00
Rubidium
b7dfa3eb90 Feature: authorized key authentication for rcon 2024-03-17 20:36:25 +01:00
Rubidium
dd532cbc77 Codechange: add setting for authorized/secret/public keys 2024-03-17 19:09:22 +01:00
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Patric Stout
8f22066b9a
Fix #12147: reset all saved settings to their default before loading a game (#12210) 2024-03-02 16:05:43 +01:00
Patric Stout
d02b1547f6
Remove: setting "no_http_content_downloads" (#12058)
As we now use HTTPS, it is very likely this will work on most systems.
For systems that do have HTTPS blocked, it will fail instantly,
and it will fallback to TCP anyway. That makes this setting no longer
very useful.
2024-02-11 14:48:12 +00:00
frosch
b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Patric Stout
7acf78964f
Remove: "generation_seed" from config, as it was a write-only value (#11927) 2024-01-30 17:02:35 +00:00
frosch
17dfc1a49a Codechange: Replace SF_GUI_NEGATIVE_IS_SPECIAL with a settings value callback. 2024-01-28 14:44:24 +01:00
frosch
9e9a8ca7f6 Codechange: Add callbacks to IntSettingDesc to support dynamic strings for title, help and values. 2024-01-28 14:44:24 +01:00
frosch
022b9e92d2 Codechange: Move settings string formatting into IntSettingDesc members. 2024-01-28 14:44:24 +01:00
Patric Stout
75f21065c9
Codechange: refactor DecodeHexText to a generic purpose ConvertHexToBytes (#11866)
DecodeHexText() does more than just decoding hex. ConvertHexToBytes()
now only does pure hex decoding. This required a bit of refactoring
for the code using DecodeHexText().
2024-01-22 19:42:47 +01:00
Rubidium
2d77cf9c80 Codechange: replace StrStartsWith/StrEndsWith with starts_with and ends_with 2024-01-17 19:48:22 +01:00
Peter Nelson
54d45a6047 Codechange: Don't keep autosave_interval in std::chrono::minutes.
This variable is saved as a setting which requires the variable type to be known, but std::chrono::minutes may vary depending on system type.

Instead, keep as uint32_t and convert to std::chrono::minutes only when setting the timer.
2023-12-09 08:13:03 +00:00
Peter Nelson
1071acb483
Codechange: Redundant use of char * and c_str(). (#11454) 2023-11-10 00:17:36 +00:00
Rubidium
c6411168d8 Cleanup: missing spaces before continuation * in some comments 2023-11-01 22:56:11 +01:00
frosch
de3f29d7b2 Add: store base graphics parameters in openttd.cfg. 2023-10-31 01:41:50 +01:00
frosch
0b7ecf6102 Codechange: use the shortname as unique id to identify the base graphics in openttd.cfg. 2023-10-31 01:41:50 +01:00
frosch
97df27e41f Codechange: Store base graphics settings in a separate section in openttd.cfg. 2023-10-31 01:41:50 +01:00
Peter Nelson
69e20e79ab Codechange: Add const versions of GetItem/GetGroup, and sprinkle liberally.
Non-const version of GetItem is not needed.
2023-10-20 18:37:27 +01:00
Peter Nelson
233aac567b Codechange: Use std::list instead of C-linked list for ini files.
This removes self-management of memory with new/delete and allows simpler iteration.
2023-10-20 18:37:27 +01:00
Peter Nelson
8bd06807e4 Codechange: Pass initializer list instead of null-terminated list of group types. 2023-10-20 18:37:27 +01:00
Peter Nelson
1fecbeff76 Codechange: Remove create parameter from IniLoadFile::GetGroup.
GetGroup now only returns nullptr if the group does not exist.
Use GetOrCreateGroup to create a group.

This avoids creating groups while reading ini files.
2023-10-20 18:37:27 +01:00
Peter Nelson
c47a0e1578 Codechange: Correct scope of IniItem for for-loop. 2023-10-20 18:37:27 +01:00
Peter Nelson
6ce7195ef1 Codechange: Split GetGroup into GetGroup/GetOrCreateGroup.
This follows the pattern used for GetItem/GetOrCreateItem, and allows use
of references where we know the group must exist.
2023-10-20 18:37:27 +01:00
Peter Nelson
54b1a067eb Codechange: Test for nullptr instead of treating pointer as boolean. 2023-10-20 18:37:27 +01:00
Peter Nelson
d3c5ae2648 Codechange: Add CreateGroup/CreateItem methods for ini files.
This abstracts the internals a bit.
2023-10-20 18:37:27 +01:00
frosch
b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Patric Stout
37e2f99c09
Change: store crash logs in JSON format (#11232) 2023-09-14 20:13:27 +02:00
Tyler Trahan
701a61c9af Codechange: Delete date_type.h 2023-09-10 08:40:25 -04:00
Tyler Trahan
77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 2023-09-10 08:40:25 -04:00
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