Commit Graph
221 Commits
Author SHA1 Message Date
Peter NelsonandGitHub 41837d093b Change: Record and show multiple errors for each NewGRF. (#14658) 2025-09-26 19:00:45 +01:00
froschandfrosch afe3dfb3a4 Codechange: Use format instead of to_string. 2025-04-29 20:26:23 +02:00
froschandGitHub 6c569f36e6 Fix #13925, 667d0137: Ancient NewGRF have empty name and description, show the filename instead. (#13932) 2025-03-31 14:25:47 +02:00
froschandGitHub 5aa4ad5135 Codechange: Pass unformatted strings from GetStringPtr as std::string_view. (#13871) 2025-03-23 19:23:31 +01:00
froschandGitHub 84f785b06b Codechange: Pass GRF name as std::string to UpdateNewGRFScanStatus. (#13870) 2025-03-23 16:58:43 +01:00
froschandGitHub 667d013726 Codechange: Return name, description and URL as std::string from GRFConfig. (#13868) 2025-03-22 20:30:40 +01:00
Rubidiumandrubidium42 a908c7bed0 Codechange: remove uses of MemCmpT (and MemMoveT) 2025-03-18 21:18:37 +01:00
Peter NelsonandGitHub fe31538a27 Codechange: Use EnumBitSet for Scanner::Modes. (#13471) 2025-02-05 20:08:12 +00:00
Peter NelsonandPeter 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 NelsonandGitHub 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
Rubidiumandrubidium42 4099acb946 Codechange: replace BSWAP32/BSWAP16 with std::byteswap 2025-01-28 19:22:12 +01:00
Peter NelsonandGitHub 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 NelsonandGitHub f6ab2b69c6 Codechange: Define GRFConfigList alias and pass by reference. (#13358)
This adds the distinction between a single GRFConfig and a GRFConfig list, and simplifies how GRFConfig lists are passed to various functions.
2025-01-22 22:30:32 +00:00
Peter NelsonandGitHub 40efc6be00 Codechange: Use member initialisation for GRFConfig instead of ZeroedMemoryAllocator. (#13343) 2025-01-19 23:31:15 +00:00
Peter NelsonandGitHub 2f0b52d5b3 Codechange: Use sorted vector for NewGRF parameter value names. (#13326)
This replaces use of a std::map per GRF-parameter.
2025-01-17 19:33:11 +00:00
Peter NelsonandGitHub 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
Peter NelsonandGitHub 00ae20fa02 Codechange: Tidy up GRFParameterInfo. (#13114)
Use member-initialisation, reorder members to reduce space, and prefer references.

SetValue/GetValue are moved to GRFConfig as they set the config's parameter values.
2024-11-23 12:13:52 +00:00
Peter NelsonandGitHub 908ee7292b Codechange: Replace all FILE * with FileHandle RAII class. (#12718)
This removes the need to manually ensure all files are closed.
2024-09-16 08:45:26 +01:00
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
Patric StoutandGitHub a3cfd23cf9 Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
froschandfrosch de3f29d7b2 Add: store base graphics parameters in openttd.cfg. 2023-10-31 01:41:50 +01:00
froschandfrosch 82c8720814 Fix #8846: When upgrading NewGRF presets, copy NewGRF parameters only if the NewGRF are compatible. Otherwise reset to defaults. 2023-10-02 22:32:30 +02:00
froschandfrosch d75a5e1a9a Fix: Upgrading NewGRF presets could result in incomplete display of NewGRF parameters until restart. 2023-10-02 22:32:30 +02:00
froschandfrosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Rubidiumandrubidium42 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
PeterNandGitHub 509471f7f8 Codechange: Use std::optional for GRFConfig::GRFError (#11066)
This changes the semantics from "object pointer ownership" to "optional object", and simplifies copies.
2023-06-25 11:57:58 +01:00
Rubidiumandrubidium42 4fdde00e25 Codechange: use std::string to create the GRF parameter list 2023-05-25 05:43:00 +02:00
Peter NelsonandPeterN 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
Peter NelsonandPeterN c23aae96a2 Codechange: Use std::array instead of C array for automatic deep-copies. 2023-05-19 16:53:56 +01:00
Rubidiumandrubidium42 acec34a0fe Cleanup: remove MD5SumToString in lieu of FormatArrayAsHex 2023-05-19 11:24:44 +02:00
Rubidiumandrubidium42 d9a04ba446 Codechange: make the MD5 hash/digest/checksum variables a std::array 2023-05-19 11:24:44 +02:00
Peter NelsonandPeterN f14479d27d Codechange: Use std::optional for GRF Parameter list. 2023-05-18 20:48:37 +01:00
Peter NelsonandPeterN c51a7f629e Codechange: GRFParameterInfo no longer needs deep-copy constructor. 2023-05-18 20:48:37 +01:00
Peter NelsonandPeterN c38df2d589 Codechange: Use std::map instead of custom SmallMap. 2023-05-18 12:18:30 +01:00
Rubidiumandrubidium42 877349c13d Codechange: use std::string for text file name resolution 2023-05-05 08:54:29 +02:00
Rubidiumandrubidium42 3901ef9760 Codechange: use std::string for the GRF filenames 2023-05-04 23:23:32 +02:00
Rubidiumandrubidium42 f78aa1e720 Codechange: use std::unique_ptr to manager GRFErrors in GRFConfig 2023-05-04 23:23:32 +02:00
Rubidiumandrubidium42 a312a6c1b2 Codechange: make md5sumToString std::string compatible 2023-05-04 23:23:32 +02:00
Rubidiumandrubidium42 c829930440 Codechange: replace strnatcmp with C++ string capable version 2023-04-29 12:07:45 +02:00
Rubidiumandrubidium42 86786a7af6 Codechange: introduce StrEqualsIgnoreCase/StrCompareIgnoreCase to replace strcasecmp 2023-04-29 10:25:25 +02:00
Niels Martin Hansen 0dce7bf85d Add: Commandline option to skip NewGRF scanning 2022-05-07 10:17:26 +02:00
rubidium42andrubidium42 09a7825d1e Remove: the concept of UnknownGRFs
These were filled with "<Unknown>" (before 8a2da49) and later their name would get filled via UDP requests to the server. These UDP packets do not exist anymore, so they will always remain "<Unknown>".
Remove that logic and just use the generic translated error GRF UNKNOWN string instead.
2021-07-18 11:42:25 +02:00
rubidium42andrubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
glx22andLoïc Guilloux 5799402f7a Codechange: Rename window related DeleteXXX to match new behaviour 2021-05-29 21:08:25 +02:00
rubidium42andrubidium42 08308d808c Codechange: use separate pre and post callbacks for int settings 2021-05-29 10:07:30 +02:00
Rubidiumandrubidium42 10e35ca8e4 Codechange: let NewGRF make use of SpriteFile instead of most of the FIO slot functions 2021-05-08 12:39:34 +02:00
Loïc GuillouxandGitHub 605bd24674 Cleanup: Leftover static const variable from a3b356e (#9194) 2021-05-05 15:32:41 +01:00
rubidium42andCharles Pigott 84985c1223 Codechange: [Network] Do not leak os_abstraction.h via fios.h 2021-04-27 18:17:34 +01:00
Patric StoutandPatric Stout 5426cb3baf Fix: abort GRFFileScanner on exiting the game as soon as possible
This prevents the window from "freezing" when you close it during
the scanning of NewGRFs, as it first would continue the action.
2021-03-10 13:41:18 +01:00
Patric StoutandPatric Stout 970fedd78c Add: make modal windows update more smooth
Basically, modal windows had their own thread-locking for what
drawing was possible. This is a bit nonsense now we have a
game-thread. And it makes much more sense to do things like
NewGRFScan and GenerateWorld in the game-thread, and not in a
thread next to the game-thread.

This commit changes that: it removes the threads for NewGRFScan
and GenerateWorld, and just runs the code in the game-thread.
On regular intervals it allows the draw-thread to do a tick,
which gives a much smoother look and feel.

It does slow down NewGRFScan and GenerateWorld ever so slightly
as it spends more time on drawing. But the slowdown is not
measureable on my machines (with 700+ NewGRFs / 4kx4k map and
a Debug build).

Running without a game-thread means NewGRFScan and GenerateWorld
are now blocking.
2021-03-10 13:41:18 +01:00