1
0
Fork 0
Commit Graph

844 Commits (8b39b23d2b1db03d485b57e4b85aa8e46e50d1f7)

Author SHA1 Message Date
Peter Nelson 8b39b23d2b
Codechange: Use EnumBitSet for VehicleFlags. (#13793) 2025-03-13 08:38:54 +00:00
Peter Nelson 7c97460080
Codechange: Use EnumBitSet for ConsistChangeFlags. (#13788) 2025-03-09 21:13:57 +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 6e10584b91
Codechange: Use EncodedStrings for News messages. (#13654) 2025-02-23 20:24:02 +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
Peter Nelson 2d7d085e8e
Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00:00
Peter Nelson 6cf7a899e9
Codechange: Use EnumBitSet for PauseMode. (#13553) 2025-02-14 08:30:04 +00:00
Rubidium c3d5e6d2a0 Codechange: Use EnumBitSet for DoCommandFlags 2025-02-14 00:28:57 +01:00
Peter Nelson 75387b9e2b Codechange: Use EnumBitSet for StationFacility. 2025-02-13 18:03:13 +00:00
Peter Nelson ca75a8ce19 Codechange: Use enum class for NewsType. 2025-02-07 19:36:52 +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 877fa54f66 Codechange: Use EnumBitSet for GRFBug enum. 2025-02-02 10:49:45 +00: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 40aeedeade Codechange: Use EnumBitSet for callback masks. 2025-01-31 17:08:24 +00:00
Rubidium e894a5880c Codechange: rename CargoID to CargoType and amend related variables/comments 2025-01-26 18:07:10 +01:00
Rubidium 08d84b2f4a Codechange: use AdviceType over StringID to remove vehicle advice news 2025-01-08 02:03:55 +01: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
Rubidium fd5f6caed4 Codechange: use explicit TileIndex constructor for tile 0 2025-01-01 08:26:54 +01:00
Peter Nelson 1e77fd0b61
Codechange: Remove unnecessary 'return_cmd_error` macro. (#13160)
This macro is a leftover from when errors used to be packed into a single int32_t.

`return CommandCost` is clearer, and doesn't need a macro.
2024-12-08 18:02:30 +00:00
Koen Bussemaker 369ea29e1e Codechange: Remove redundant checks in FindClosestTrainDepot 2024-11-19 20:42:43 +01:00
Peter Nelson a171939ec3 Codechange: Remove `m_` prefix from pathfinders. 2024-10-25 19:01:39 +01:00
SamuXarick d5a13fb9f4
Codechange: Use TileOffsByAxis(...) in more places (#13026) 2024-10-24 15:58:15 -04:00
Peter Nelson 6deee5e5e2
Fix: Train curve detection did not take shortened parts into account. (#12910)
Only the number of parts between curves was counted, which with shortened parts would be higher than full length parts and fail to limit as expected.
2024-09-12 06:47:54 +01:00
Jonathan G Rennison e477706bf5
Codechange: Add AssignBit function to assign the value of a single bit (#12934)
* Codechange: Add AssignBit function to assign the value of a single bit

* Codechange: Replace various uses of SB with AssignBit

* Codechange: Replace various uses of SB with a constant with SetBit
2024-09-10 08:36:58 -04:00
Jonathan G Rennison 88110e9b2e
Fix: Train unit ID allocation when moving engine to new train at train limit (#12887) 2024-08-13 14:53:10 -04:00
Michael Lutz ddf6f33a8a
Change: Path signals now show green on junction-less tracks by default (#12857) 2024-07-26 23:51:49 +02:00
Loïc Guilloux d67963e616
Add: [Script] Include number of victims in ScriptEventVehicleCrashed (#12861) 2024-07-16 21:28:29 +02:00
merni-ns 55a7c59d13 Remove: NPF and pathfinder change settings 2024-05-10 10:38:44 +02:00
Jonathan G Rennison 433484cda3
Fix #12388: Vehicle::CopyVehicleConfigAndStatistics not releasing unit number (#12389) 2024-03-27 21:20:27 +01:00
Peter Nelson 3fc7b3b9a0 Codechange: Cache train curve speed limit can be stored in 16 bits.
Cache curve speed modifier and max curve speed are both 16 bit values so can be stored in 16 bit types instead of 32 bit types.
2024-03-17 16:22:38 +00:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Tyler Trahan 32b0fb9f6e
Fix #12010: Use economy timer for vehicle stats minimum age, not calendar (#12142) 2024-03-09 09:38:52 -05:00
Peter Nelson 56cf89d189
Change: Use bitmap for free unit ID generation. (#12165)
This improves performance of finding the next free unit number for a vehicle.

Based loosely on pool's used slot bitmap.
2024-02-25 12:36:13 +00:00
Peter Nelson 2fd9096070
Change: Decouple and remove landscape-dependent cargo types. (#11719)
Cargo types of default engines, industries and houses are now specified in terms of label.
2024-02-04 10:16:08 +00:00
Tyler Trahan f6dd5053a3
Feature: Order flag to unbunch vehicles at depot (#11945) 2024-02-03 08:04:24 -05:00
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Tyler Trahan 735abfe111
Codechange: Split dates and timers into Economy and Calendar time (#10700) 2024-01-22 09:04:34 -05:00
Rubidium 6b21368bc2 Codechange: replace FIND_FIRST_BIT/FindFirstBit2x64 with FindFirstBit 2024-01-19 21:10:39 +01:00
Peter Nelson ddd609ce9b
Feature: Randomize direction of rail vehicle on build based on probability callback. (#11489)
This allows NewGRF authors to indicate that the game should randomly flip rail vehicles on build, without needing to use random bits nor duplicate sprites to handle it themselves.

To use this functionality, test for callback 162 (CBID_VEHICLE_BUILD_PROBABILITY)  and var10 = 0 (values other than 0 are reserved for future use), and return a value between 0 and 100 inclusive.

The return value is a percentage chance of reversing the vehicle. A value of 0 will always build a forward facing vehicle, and 100 will always build a reverse facing vehicle.
2023-11-29 22:40:09 +00:00
Peter Nelson e6d132d24b
Fix #10926: New free wagons no longer split by type. (#11507)
NormalizeTrainVehInDepot() should only be called if an engine was built, not for wagons.
2023-11-28 13:48:09 +00:00
Peter Nelson 43aa91a7f5
Fix #11437: Flipped shorter rail vehicles disappear in windows. (#11446)
Mixed signed/unsigned strikes again, causing an incorrect sprite offset for shortened vehicles.
2023-11-05 20:09:11 +00:00
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 2023-10-20 23:05:43 +02:00
Jonathan G Rennison 3afb732c37 Fix #11307: Incorrect GroupStatistics after selling leading wagon
When this results in a countable consist
2023-09-17 18:42:37 +01:00
PeterN acd7d3c913
Codechange: Rename *Railtype* to *RailType* for consistency. (#11287) 2023-09-11 08:55:12 +00:00
Tyler Trahan 77173a6a10 Codechange: Move date consts and functions to CalendarTime and TimerGameCalendar classes 2023-09-10 08:40:25 -04:00
Tyler Trahan fca2b37726 Codechange: Move Ticks into their own class 2023-09-10 08:40:25 -04:00
Tyler Trahan 9a602ff304
Fix #10334: Store separate newgrf-safe version of date_of_last_service. (#11124)
This value is not changed when the date cheat is used, which caused issues with changing properties based on service date.

Co-authored-by: Peter Nelson <peter1138@openttd.org>
2023-08-06 12:57:10 -04: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