1
0
Fork 0
Commit Graph

324 Commits (22fedca77ea125da991aba78dc8e0f074f5b4667)

Author SHA1 Message Date
frosch 22fedca77e Codechange: Integrate ResolverObject::ResetState() into DoResolve(), no need to call it manually. 2025-05-06 22:24:41 +02:00
frosch 6faa667644 Codechange: Remove global GetRegister(), instead return 100+ registers directly from GetXxxCallback(). 2025-05-06 22:24:41 +02:00
frosch 85be7a4d92 Codechange: Access temporary storage through ResolverObject during Resolve. 2025-05-06 22:24:41 +02:00
frosch 99d7a775ad Codechange: Make GetRegister return a signed integer, matching the underlying TemporaryStorageArray. 2025-05-06 22:24:41 +02:00
frosch 13349254ea
Fix #14216, d030d17: RealSpriteGroups referencing CallbackResultSpriteGroups were always treated as callback-failure. (#14218) 2025-05-05 16:13:41 +02:00
frosch d030d17bd6 Codechange: Do not use a mutable global to return calculated VarAction2 results. 2025-04-29 20:35:46 +02:00
frosch e90b68d504 Codechange: Pass SpriteGroup as reference to ResolveReal. 2025-04-29 20:35:46 +02:00
frosch 8027e31f47 Codechange: Remove virtual functions SpriteGroup::GetResult and GetNumResults. They are only implemented in and called via ResultSpriteGroup. 2025-04-29 10:35:10 +02:00
frosch 010b944173 Codechange: Move SpriteGroup cast from callers into Resolve. 2025-04-29 10:35:10 +02:00
frosch 30b1eb6e5f
Fix: [NewGRF] The result of Action123 evaluation affected rerandomisation in a weird corner case. (#14139)
Rerandomisation does not care about the Resolve result.
But we skipped it, in case of 'invalid SpriteGroup reference'.
2025-04-28 23:24:42 +02:00
frosch b7e7f08f78 Codechange: Simplify usage of GRFFileProps by adding some common helper methods. 2025-04-28 13:44:46 +02:00
frosch 41a20e512d Codechange: Use proper enum type to index sprite groups in VariableGRFFileProps. 2025-04-27 19:50:51 +02:00
frosch 61a0a520f6
Codechange: Unify random trigger enums and turn them into enum classes. (#14066) 2025-04-21 20:03:34 +02:00
frosch 264abfafe6 Codechange: Rename storage of random triggers to include the term 'random'. 2025-04-21 19:06:13 +02:00
frosch 39220a5feb Codechange: Unify naming of NewGRF random trigger functions. 2025-04-21 19:06:13 +02:00
frosch 98445088b1
Codechange: Move VehicleEnteredDepotThisTick call to a more suitable position. (#14065) 2025-04-21 17:52:03 +02:00
frosch 8f335a84cf Codechange: Turn GetCustom(Vehicle|Rotor)(Sprite|Icon) macros into functions. 2025-04-18 23:41:37 +02:00
frosch b862d4937f
Codechange: Turn custom vehicle spritenums into enum, and use them consistently. (#14022) 2025-04-18 15:19:28 +02:00
Rubidium a908c7bed0 Codechange: remove uses of MemCmpT (and MemMoveT) 2025-03-18 21:18:37 +01:00
enveeed b0cc56a8b5
Fix: NewGRF vehicles display loading sprites when not actually loading or unloading (#13554) 2025-03-15 16:58:47 -04:00
Peter Nelson 8b39b23d2b
Codechange: Use EnumBitSet for VehicleFlags. (#13793) 2025-03-13 08:38:54 +00:00
Peter Nelson 91d22f7617
Codechange: Use EnumBitSet for VehStates. (#13755)
Renamed from VehStatus because pluralising that is weird.
2025-03-08 18:24:21 +00:00
Peter Nelson 3fde611012
Codechange: Use EnumBitSet for AirportMovingDataFlags. (#13754) 2025-03-06 19:03:41 +00:00
Peter Nelson a8f56fe7b3
Add: Variable to test how many vehicles in a chain contain a specific badge. (#13594) 2025-02-25 20:55:11 +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
Rubidium fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidium 59df0ff496 Codechange: strongly type StationID 2025-02-16 18:25:51 +01:00
Rubidium 70c9f3963c Codechange: strongly type VehicleID 2025-02-16 14:50:15 +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
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
Jonathan G Rennison d06b371254 Cleanup: Fix various spelling errors 2025-02-12 22:44:51 +01:00
Peter Nelson d61b376998
Codechange: Use EnumBitSet for CargoClasses. (#13491) 2025-02-08 08:46:38 +00:00
Rubidium e937c4dcfd Codechange: change DestinationID into class with conversion helpers
A DestinationID is either a DepotID or StationID, where the aircraft hangar
being conceptually a depot is actually a StationID. When making those types
stronger, a lot of casts would need to be added, but this shows the intent
much better.
2025-02-06 21:03:24 +01:00
Peter Nelson f8b1e3033f Codechange: Use EnumBitSet for EngineFlags. 2025-01-31 18:55:31 +00:00
Peter Nelson 6c4ddb242a Codechange: Use EnumBitSet for EngineMiscFlags. 2025-01-31 18:55:31 +00:00
Peter Nelson 917d5cc75d
Codechange: Use EnumBitSet for RoadTypeFlags and RailTypeFlags. (#13415) 2025-01-30 22:08:51 +00:00
Peter Nelson afc0745aa2
Codechange: Specify underlying type for all enums excluding those exposed to scripts. (#13383) 2025-01-28 22:17:34 +00:00
Rubidium e894a5880c Codechange: rename CargoID to CargoType and amend related variables/comments 2025-01-26 18:07:10 +01:00
Peter Nelson 41c9f2d82c
Codefix: Pass cargo as CargoID. (#13311) 2025-01-13 19:23:26 +00:00
Peter Nelson cfb995b6e9
Codechange: Reimplement engine sort order with std::rotate. (#13124) 2024-12-05 22:17:40 +00:00
Peter Nelson f56b6756f1 Codechange: Sort EngineOverrideManager for fast lookups.
Allows quickly finding the EngineID given the type, grfid and local id of an engine, instead a linear scan.

This can reduce loading time when lots of engines are present and also affects performance in-game.
Lookup can be on the order of 10000 times faster.
2024-12-05 18:17:58 +00:00
Peter Nelson bc2513975f Codechange: Don't inherit EngineOverrideManager from std::vector.
Inheriting from std::vector means some operations are needlessly complex, and shouldn't really be done anyway.
2024-12-05 18:17:58 +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
Peter Nelson 3be0166801 Codechange: Use std::ranges::find where possible.
Replace `std::find(range.begin(), range.end(), ...)` with `std::ranges::find(range, ...)`.
2024-11-24 10:36:03 +00:00
Peter Nelson 0340e19e04
Codechange: Add to_underlying() to convert enum to underlying type. (#12958)
This simplifies and replaces static_cast and C-style casts doing the same.

`std::to_underlying()` exists in C++23 but not C++20.
2024-09-22 18:07:42 +01:00
Loïc Guilloux 29ce013eda
Codechange: Pass avail(able) as reference instead of pointer since they are never nullptr (#12696) 2024-05-18 17:04:16 +02:00
Peter Nelson 1424a184d8
Codechange: Use vector/span when loading wagon overrides. (#12604)
Replaces manual memory allocation and passing pointer with size.
2024-05-01 18:23:27 +01:00
Peter Nelson bf8de188ec
Codechange: Use member initialization of GRFFilePropsBase. (#12581)
Don't blame compilers for our sloppy initialisation.

Removes memset, and lengthof.
2024-04-26 22:58:54 +01:00