Commit Graph

605 Commits

Author SHA1 Message Date
Rubidium
1ffc950e22 Codechange: use prefix operator++ for CompanyID iterations 2025-02-16 14:02:18 +01:00
Peter Nelson
2d7d085e8e
Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00:00
Rubidium
c3d5e6d2a0 Codechange: Use EnumBitSet for DoCommandFlags 2025-02-14 00:28:57 +01:00
Peter Nelson
d9bb002cac
Codechange: Use local parameters for formatting settings values. (#13487) 2025-02-07 20:18:03 +00:00
Peter Nelson
6f52a977a8 Codechange: Use EnumBitSet for GRFConfigFlags.
This is renamed from `GCF_Flag` didn't match convention.
2025-02-02 10:49:45 +00:00
Peter Nelson
c4c5028862
Codechange: Use EnumBitSet for SettingFlags. (#13429) 2025-02-01 15:46:51 +00:00
Peter Nelson
5664b1e2f6
Codechange: Use std::vector for GRFConfig lists. (#10835)
This replaces the C-style custom managed linked-list and allows use of iterators etc.
2025-01-31 17:09:09 +00:00
Rubidium
4099acb946 Codechange: replace BSWAP32/BSWAP16 with std::byteswap 2025-01-28 19:22:12 +01:00
Peter Nelson
9b947a37b8
Codechange: Pass GRFConfig by reference where feasible. (#13388)
In places where a GRFConfig is passed by pointer and not checked for nullptr, use a reference instead.
2025-01-26 22:41:08 +00:00
Peter Nelson
3edf19a2c5
Add: Sandbox settings to Sandbox Options window. (#13268) 2025-01-14 21:22:19 +00:00
glx22
7493b2d0c1 Codechange: Add callback to IntSettingDesc to support dynamic min/max 2025-01-05 23:31:50 +01:00
Loïc Guilloux
1364b9f641
Fix: Hide company settings from console commands (#13269) 2025-01-04 15:13:08 +01:00
Loïc Guilloux
a52923b3b9
Codechange: Make GetDefaultValueCallback() more similar to other setting override callbacks (#13259) 2025-01-04 00:17:47 +01:00
Peter Nelson
d38ecd6525
Change: Log changes to sandbox settings. (#13267)
One of the features of cheats is that there is a record of a cheat being used.

As cheats are slowly ending up in settings instead, add a flag so that changes to these sandbox settings are logged.
2025-01-03 23:12:49 +00:00
Loïc Guilloux
b3660bf24a
Fix: IntSettingDesc may have a callback for default value (#13240) 2025-01-03 15:05:56 +01:00
Peter Nelson
3a310f1802
Codechange: Store GRFConfig parameters in a vector. (#13137)
All GRFConfigs have space allocated for parameters, but only configured GRFConfigs need them.

Using a vector instead means that space is only used when parameters are used.
2024-12-01 15:15:21 +00:00
Rubidium
f2a8e18792 Fix 208952f: incorrect truncation in string setting validation 2024-09-02 22:16:26 +02:00
Rubidium
3094b0ce1d Feature: admin support for password authentication without sending password
Using either password authenticated key exchange (PAKE) or authorized keys
2024-07-01 17:16:55 +02:00
Peter Nelson
b30fe0d7da Feature: Ctrl-click to toggle favourites in build-pickers.
This allows ctrl-click on a type in a build-picker window to remember it
as a favourite. An new filter button to show only favourites makes it
simpler to use these types.

Favourite types are saved locally in favs.cfg, so are remembered between
games.
2024-05-11 02:12:41 +01:00
Rubidium
a313676189 Doc: reason for using ::SendNet over ::Post in few cases 2024-05-09 21:51:26 +02:00
Rubidium
1691b41b54 Codechange: use C++ containers for parsing the settings int lists 2024-04-20 11:57:45 +02:00
Peter Nelson
a28ab8cac2
Codechange: Replace C-style casts to size_t with static_cast. (#12455)
* Codechange: Replace C-style casts to size_t with static_cast.

This touches only simple value-type casts.

* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX

Co-authored-by: Rubidium <rubidium@openttd.org>
2024-04-19 20:34:36 +01:00
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