Commit Graph

133 Commits

Author SHA1 Message Date
frosch
41a20e512d Codechange: Use proper enum type to index sprite groups in VariableGRFFileProps. 2025-04-27 19:50:51 +02:00
frosch
42deccc4f5 Codechange: Merge (IsOn|Toggle)(Snow|Desert) into (IsOn|Toggle)SnowOrDesert. 2025-04-18 16:33:26 +02:00
Peter Nelson
1f83ea41fc
Fix: [NewGRF] PrepareLayout worked on a copy of the data resulting in bad sprite layouts. (#14013) 2025-04-16 21:27:36 +00:00
Peter Nelson
a281ac4674 Codefix: Information for NewGRF specs remained duplicated after loading.
After loading airports+tiles, industries+tiles, houses and objects, their specs are copied from the NewGRF's loading storage to the final global storage.

Instead, move the specs to the their new storage, and clear the NewGRF's storage once done. (Stations and RoadStops are different, and the NewGRF's storage is the final storage location.)
2025-04-16 19:43:07 +01:00
Peter Nelson
91ab7f10cd Codefix: Avoid using override keyword as member name.
Rename `GRFFileProps` `override` member to `override_id`.
2025-04-09 22:02:35 +01:00
Peter Nelson
79ef4e98fe
Codechange: Use std::swap() instead of Swap() (#13883) 2025-03-24 23:47:34 +00:00
frosch
dbea968f4f
Codefix 20e57a02a2: String parameters were off by one. (#13810) 2025-03-14 15:22:30 +01:00
Peter Nelson
b28dca2222
Codechange: Preprocess text ref stack parameters. (#13642)
NewGRF text ref stack is now processed in advance, creating parameters as necessary, and then encoding this into an EncodedString.
2025-02-22 22:03:38 +00:00
Peter Nelson
9de913dd21
Codechange: Use helper to set grf_prop's grffile and grfid together. (#13612) 2025-02-18 22:33:13 +00:00
Peter Nelson
ed57b9c297
Fix faa845398f: Crash when loading tile layout with no building sprites. (#13589)
Tile layouts are permitted to have no building sprites, therefore the test for an empty sequence of sprites is not valid.
2025-02-16 22:29:56 -05:00
Rubidium
ab8177ea77 Codechange: strongly type CompanyID 2025-02-16 14:02:18 +01:00
Rubidium
a50c953854 Codefix: Clone should make a clone, not copy some data to another instance 2025-02-16 12:31:25 +01:00
Rubidium
faa845398f Codechange: use std::vector for NewGRFSpriteLayout registers 2025-02-16 12:31:25 +01:00
Rubidium
44506ebc86 Codechange: use span size over terminator object 2025-02-16 11:19:12 +01:00
Peter Nelson
2d7d085e8e
Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00:00
Peter Nelson
ff7eb996e6
Codechange: Use variable storage for GrfProps with cargo-type groups. (#13557)
Slots are only allocated when used instead of being reserved.

Array-based GrfProps are still used when the number of options is more limited.
2025-02-14 18:30:17 +00:00
Rubidium
069ff846e4 Codechange: use std::vector/std::span for DrawTileSprites over malloc-ed table 2025-02-14 16:01:45 +01:00
Peter Nelson
20e57a02a2
Codechange: Use GetString() with argument parameters in simple cases. (#13551)
Avoids using global string parameters.
2025-02-14 00:10:56 +00:00
Peter Nelson
877fa54f66 Codechange: Use EnumBitSet for GRFBug enum. 2025-02-02 10:49:45 +00:00
Peter Nelson
59354576d4
Codechange: Use EnumBitSet for LandscapeTypes and remove LandscapeID. (#13436) 2025-02-01 23:09:18 +00:00
Peter Nelson
2d372fa516 Codechange: NewGRF strings are not StringIDs.
Add GRFStringID type and use it when dealing with GRF-local string IDs.
2025-01-02 20:03:40 +00:00
Peter Nelson
e73d6fcaac Codechange: Store grfid with entity grfprops.
This allows using the grfid without having to dereference the grffile pointer.

Uses no extra storage as it fits within otherwise wasted padding space.
2024-12-05 18:17:58 +00:00
Jonathan G Rennison
9c84e5df3f Add: Road waypoint functionality 2024-06-24 22:12:08 +02:00
Peter Nelson
3e83dcedfd Codechange: Allocate houses dynamically instead of from a fixed array.
This uses vectors for HouseSpecs and global/town building counts.
2024-03-28 23:23:00 +01:00
Patric Stout
a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Michael Lutz
8dda387f82 Codechange: Use std::tuple for slope functions with two return values 2024-03-08 18:08:55 +01: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
Rubidium
1a179cb297 Codechange: use GetString + StrMakeValid to pass string without colours/font sizes to Debug 2023-05-21 21:17:12 +02:00
Rubidium
fb856e16c1 Codechange: replace some min/clamp constructs to ClampTo 2023-05-06 21:26:13 +02:00
Peter Nelson
912eb68981 Change: Extend entity override manager and station spec lists to support 16 bit IDs. 2023-05-05 07:08:40 +01:00
Peter Nelson
370a8d77a4 Codechange: Use simple assignment to assign specs. 2023-04-23 15:58:27 +01:00
Rubidium
7088f5b7c7 Codechange: use string/fmt instead of printf for grfmsg 2023-04-18 23:21:08 +02:00
Peter Nelson
1f46f080f0 Codechange: Store objectspecs in std::vector instead of flat array. 2023-04-02 22:42:38 +01:00
Peter Nelson
93197f58b7 Codechange: Bind objectspecs to classes once all finalised. 2023-04-02 22:42:38 +01:00
Peter Nelson
ede1201b6a Codechange: Rename override manager variables. 2023-01-26 21:39:16 +01:00
Peter Nelson
bcc53c5ad5 Codechange: Add missing this-> in override manager.
Variable scope is also tweaked in a couple of cases reducing line count.
2023-01-26 21:39:16 +01:00
Peter Nelson
eedb786872 Codechange: Use vector for NewGRF spec overrides.
This replaces C-style memory management.
2023-01-26 21:39:16 +01:00
Rubidium
de6bc8e692 Codechange: move TILE_MASK to Map::WrapToMap 2023-01-21 17:11:40 +01:00
rubidium42
55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
rubidium42
44ca7d9377 Change: Use gender-neutral pronouns 2021-05-15 10:16:48 +02:00
Michael Lutz
79240eab1e Codechange: Make use of the improved C++17 emplace_back function. 2020-12-15 00:29:30 +01:00
S. D. Cloudt
13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Niels Martin Hansen
53f8d0b815 Codechange: Use std::vector for industry tile layouts 2019-10-19 17:16:25 +01:00
JMcKiern
04f659e768 Fix: Some typos found using codespell 2019-09-29 21:27:32 +01:00
Henry Wilson
7c8e7c6b6e Codechange: Use null pointer literal instead of the NULL macro 2019-04-10 23:22:20 +02:00
Henry Wilson
c01a2e2a81 Codechange: Removed SmallVector completely 2019-03-26 20:15:57 +00:00
Henry Wilson
ab711e6942 Codechange: Replaced SmallVector::[Begin|End]() with std alternatives 2019-03-26 20:15:57 +00:00
Henry Wilson
a0f36a50e6 Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back() 2019-03-26 20:15:57 +00:00
Henry Wilson
bfd79e59dc Codechange: Replace SmallVector::Clear() with std::vector::clear() 2019-03-26 20:15:57 +00:00
rubidium
0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00