Commit Graph

1053 Commits

Author SHA1 Message Date
Peter Nelson b4367c3593 Change: Record and show multiple errors for each NewGRF. (#14658) 2025-12-08 04:17:08 +05:00
Peter Nelson 3bb1b847d3 Fix 3ac1a2f1e4: Game crash due to invalid vehicle type information. (#14628)
Use std::variant instead of union for vehicle info.

RailVehicleInfo is now non-POD so using in a union causes undefined behaviour.
2025-12-08 04:15:17 +05:00
Jonathan G Rennison bbd8ea4abe Fix: Variant cycle detection in FinaliseEngineArray (#14629) 2025-12-08 03:23:13 +05:00
Michael Lutz b16ba117cc Codechange: Store the rail type of rail engines as a RailTypes bitmask. 2025-12-08 03:17:35 +05:00
Rubidium 7c0f69a8fe Codefix: typos in comments and strings 2025-08-31 10:30:37 +02:00
Peter Nelson a46a3a97f3 Change: New company face definition system and UI. (#14319)
Bits used by company faces are now defined by a variable system instead of being hardcoded, allowing future expansion.

The four face types covering gender and skin colour are now separate face styles with their own definitions.
2025-06-24 07:59:49 +01:00
Jonathan G Rennison 63f1c2aa3a Codechange: Use TypedIndexContainer for typed index containers
Instead of ReferenceThroughBaseContainer
2025-06-12 18:50:49 +01:00
Peter Nelson c2d4098afa Add: Configuration of NewGRF badges. 2025-05-25 09:13:05 +01:00
Peter Nelson 0aacd7acb3 Codechange: Use GrfSpecFeature type instead of uint8_t. (#14253) 2025-05-12 08:44:39 +01:00
Peter Nelson 2c4897c2cd Codechange: Use EnumBitSet for HouseZones. (#14137) 2025-04-28 20:27:43 +01:00
Rubidium 49ef3eee13 Codechange: replace char* with std::string_view 2025-04-27 20:08:02 +02:00
Peter Nelson 2c59838acb Codechange: (re)set multiple bitset flags in one call. (#14017) 2025-04-18 14:07:57 +01: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 f9ab492e64 Codechange: Pass HouseSpec by reference to IsHouseSpecValid(). 2025-04-16 19:43:07 +01:00
frosch 96eee0e8e4 Codechange: Base ByteReader on StringConsumer. 2025-04-13 21:59:10 +02:00
Peter Nelson 34b1f7a992 Fix: Make GrfMsg() behave like Debug() when not loading NewGRFs. (#13991)
GrfMsg() outputs the currently loading NewGRF and current line/sprite number. This is invalid when not NewGRFs are not actually being loaded.
2025-04-12 13:05:33 +01:00
frosch 1cfad1474a Codechange: Rename _cur to _cur_gps. 2025-04-11 22:11:28 +02:00
Peter Nelson f57065dd41 Codefix: Avoid using override keyword as variable names.
Rename variables named `override`.
2025-04-09 22:02:35 +01:00
Peter Nelson 981b2a94db Codechange: Store loaded GRFFiles in vector directly. (#13940)
Removes pointer management.
2025-04-06 20:16:57 +01:00
Peter Nelson 2ae84f3c9e Codechange: CargoSpec::Iterate already tests cargo validity. (#13941) 2025-04-01 18:23:26 +01:00
Peter Nelson 047497734b Cleanup: Remove redundant NewGRF clean up functions. (#13927)
These functions no longer clean up manually managed memory, they simply clear GRFFile's vectors of unique_ptrs. This will happen anyway when the GRFFile is deleted.
2025-03-31 20:33:09 +01:00
Peter Nelson 828e808444 Codechange: Split NewGRF loader into separate Action handlers. 2025-03-23 16:59:36 +00:00
Peter Nelson 0b7fa11a5b Codechange: Move NewGRF string mapping to own file. 2025-03-23 16:59:36 +00:00
Peter Nelson 2cb389946d Codechange: Move GrfProcessingState to separate file.
Allows reuse by other files.
2025-03-23 16:59:36 +00:00
Peter Nelson fe9dfa2b08 Codechange: Move NewGRF ByteReader to own file. 2025-03-23 16:59:36 +00:00
Peter Nelson 21d2a94809 Codechange: Use EnumBitSet for GrfMiscBits. (#13873) 2025-03-22 21:07:59 +00:00
Peter Nelson e47082bf7b Codefix: Don't look up NewGRF Action 6-modified data twice. (#13863) 2025-03-21 18:13:31 +00:00
Rubidium c13226cdf8 Codefix: do not leave pointers to stack allocations in globals 2025-03-15 21:46:43 +01:00
Rubidium dae788e2e3 Codefix: do not trust allocation sizes coming from a file 2025-03-15 21:44:40 +01:00
Rubidium cf96a97e95 Codefix: remove unneeded looping logic 2025-03-15 21:42:28 +01:00
Rubidium 754311a779 Codechange: use std::move when appropriate 2025-03-13 13:00:24 +01:00
Peter Nelson ec71f7a216 Codechange: Use std::array for temporary NewGRF loading data.
This allows initialisation without memset.
2025-03-09 18:03:50 +00:00
Peter Nelson 2a05a845df Feature: Snow-covered rocks are now visible. 2025-03-04 20:39:08 +00:00
Rubidium 8b7c92dfe3 Codechange: explicitly initialise NewGRF-pool-object member variables 2025-02-22 15:34:44 +01:00
Rubidium b64e8c0aea Codechange: use std::vector/std::span over MallocT for NewGRF bridge sprites 2025-02-22 15:34:32 +01:00
Rubidium 3e511f2ce7 Codechange: remove ZeroedMemoryAllocator from GRFFile 2025-02-22 14:58:26 +01:00
Jonathan G Rennison 8566030c53 Cleanup: Adjustments to comments to match code changes (#13636) 2025-02-22 13:28:35 +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 8f14894024 Add: NewGRF Badges. 2025-02-16 22:24:25 +00:00
Peter Nelson 0af5d5a9e6 Codechange: Make non-generic GRF string ids unique per feature.
This prevents engine name strings conflicting with generic strings if more than 53,248 engines are defined.
2025-02-16 22:24:25 +00:00
Rubidium fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidium 7e04651220 Codechange: strongly type EngineID 2025-02-16 14:50:15 +01:00
Rubidium 9015c3651f Codechange: make EngineID an enum 2025-02-16 14:50:15 +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 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
Jonathan G Rennison d06b371254 Cleanup: Fix various spelling errors 2025-02-12 22:44:51 +01:00
Peter Nelson 1ed685b5c1 Codechange: Use EnumBitSet.Any(). (#13512) 2025-02-09 20:16:16 +00:00