Tyler Trahan
18f2f7eb2d
Codechange: Use enum class for setting values ( #15074 )
2026-01-10 22:40:48 +00:00
Cyprian Klimaszewski
d405e4cb09
Codechange: Use proper widget type and update widgets properly ( #14870 )
...
For vehicle window.
2026-01-08 22:31:00 +00:00
Tyler Trahan
e97213e7e2
Change: Vehicles loading at stations don't lose reliability ( #14841 )
2026-01-08 15:34:50 -05:00
Rubidium
2e6f8fe191
Codefix: use constructor to set index of PoolItems over 'magic'/UB
2026-01-03 16:04:32 +01:00
Rubidium
2fcd4e189a
Codechange: replace 'new PoolItem(...' with 'PoolItem::Create(...'
2026-01-03 16:04:32 +01:00
Peter Nelson
ebbb7cf3e9
Codechange: Pass company ID to SubtractMoneyFromCompany. ( #15018 )
...
This avoids needing to backup and restore `_current_company` just for SubtractMoneyFromCompany to use it.
2026-01-03 09:33:37 +00:00
Peter Nelson
c6679bbcab
Fix #14945 : Hang when deleting implicit orders during vehicle loading. ( #14946 )
2025-12-21 15:08:13 +00:00
Cyprian Klimaszewski
99f04f27de
Doc: Update information for receiving a copy of GPL. ( #14869 )
2025-12-07 11:25:08 +00:00
Peter Nelson
9adc4bfc0f
Codechange: Make order load/unload flags value types. ( #14861 )
...
Order Load and Unload flags have complex logic to ensure that invalid combinations aren't used. In fact, apart from FullLoad and FullLoadAny, all mixed combinations are invalid.
Simplify logic by removing the use of bit values and treat each option as a value.
2025-12-06 18:30:31 +00:00
Peter Nelson
046b0c6267
Codechange: Use enum class and EnumBitSet for various order flags. ( #14783 )
2025-12-06 12:29:11 +00:00
Peter Nelson
34bbae05db
Codechange: Use enum/EnumBitSet for livery in use flags. ( #14746 )
...
Replaces magic numbers.
2025-11-01 14:25:24 +00:00
Peter Nelson
42c9f84d74
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-09-24 22:44:41 +01:00
Michael Lutz
3ac1a2f1e4
Codechange: Store the rail type of rail engines as a RailTypes bitmask.
2025-09-14 17:11:26 +02:00
Peter Nelson
febf8b0d57
Fix #14561 : Vehicle effects missing for vehicle on bridge. ( #14563 )
2025-08-31 18:27:46 +01:00
Peter Nelson
921d83c324
Codechange: Unify structures with sprite sub-tile bounds and simplify bounding boxes. ( #14424 )
...
Lots of different structs contain variations on sub-tile bounds with different naming. Unify into a single struct that can be inherited and passed directly to AddSortableSpriteToDraw.
At the same time, offsets now work more logically: sub-tile bounds now specify the bounding box, and an offset can be applied to the sprite.
2025-07-22 00:02:00 +01:00
Peter Nelson
e2d066e5d3
Codefix: Effect vehicles don't use v->tile, so shouldn't be in the vehicle tile hash. ( #14302 )
2025-05-26 21:45:46 +01:00
Peter Nelson
0455627d16
Codechange: Move ownership of Orders to OrderList. ( #13948 )
...
Removes the orders pool, and orders are now stored directly in each OrderList.
Iterating orders now no longer needs to traverse a linked-list, all orders in an OrderList are sequential.
2025-05-23 10:36:28 +01:00
SamuXarick
8f3f25de4b
Codefix: Missing 'this->' in VehiclesNearTileXY::Iterator::Iterator ( #14288 )
2025-05-21 20:28:47 +02:00
Peter Nelson
ce83f583bc
Codechange: Use EnumBitSet for VehicleRailFlags. ( #14280 )
2025-05-19 18:56:45 +01:00
frosch
6faa667644
Codechange: Remove global GetRegister(), instead return 100+ registers directly from GetXxxCallback().
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
0d5b3ebd7f
Codechange: Declare all IntervalTimers const, which can be const.
2025-05-06 18:29:41 +02:00
frosch
3a70d1e2f7
Codechange: Pass the max-distance as parameter to VehiclesNearTileXY.
2025-04-26 19:32:59 +02:00
frosch
2df1233f1f
Codechange: Clamp the search area to valid values for the hash bucket selection.
...
The bucket selection uses a truncating division instead of a flooring division, so it does not work for negative positions.
Anyhow, there are no negative tile coordinates, so just clamp the search area.
2025-04-26 19:32:59 +02:00
frosch
0f76ba122c
Codefix: VehiclesNearTileXY yielded all vehicles with matching hashes, even if they are far away.
2025-04-26 19:32:59 +02:00
frosch
ce2155ab27
Codechange: Remove unused FindVehicleOnPosXY/HasVehicleOnPosXY.
2025-04-26 16:54:56 +02:00
frosch
9f1c04c0e1
Codechange: Add VehiclesNearTileXY and HasVehicleNearTileXY to iterate over/check for ground vehicles near a tile coordinate.
2025-04-26 16:54:56 +02:00
frosch
ac3ed9f3ad
Codechange: Deduplicate and simplify tile hash arithmetic.
2025-04-26 16:54:56 +02:00
frosch
2bee313642
Codechange: Replace FindVehicleOnPos with 'for' loop.
2025-04-22 22:12:59 +02:00
frosch
06c399b79e
Codechange: Replace HasVehicleOnPos and callbacks with HasVehicleOnTile and lambda-predicates.
2025-04-22 22:12:59 +02:00
frosch
fca3103d8c
Codechange: Add iterator for vehicles on a tile.
2025-04-22 22:12:59 +02:00
frosch
d7ddea4032
Codechange: Turn AnimationTrigger enums into enum classes. ( #14067 )
2025-04-21 20:53:31 +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
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
Peter Nelson
fc45bb5a2b
Codechange: Replace bitstuffed VehicleEnterTileStatus. ( #14027 )
...
VehicleEnterTileStatus was an bitset-style enum, but bitstuffed with a StationID. However the StationID part was only used by trains, and only in two locations.
Instead, return just the enum bitset. The two places which require the StationID just call GetStationIndex() directly.
2025-04-20 21:10:02 +01:00
frosch
53899c3c21
Codechange: Replace vehicle viewport hash macros with functions.
2025-04-18 23:41:37 +02:00
Peter Nelson
936d78fefc
Codefix: Avoid uppercase characters in variable names. ( #13985 )
2025-04-10 07:19:27 +01:00
Peter Nelson
8275bbfb87
Codechange: Pass Viewport by reference.
...
This means we do not have to care what type of pointer is used.
2025-04-09 22:03:23 +01:00
Peter Nelson
fc7b6c6cbb
Codechange: Use .fill() to clear an array instead of assigning a new array. ( #13880 )
...
Avoids allocating a temporary on the stack.
2025-03-23 22:09:45 +00:00
Peter Nelson
8b39b23d2b
Codechange: Use EnumBitSet for VehicleFlags. ( #13793 )
2025-03-13 08:38:54 +00:00
Peter Nelson
52bada216c
Codechange: Use std::array for vehicle hashes.
...
This allows initialisation without memset.
2025-03-09 18:03:50 +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
47ae285c9d
Fix 2d7d085e8e: Autorenew failed error string consumed too many parameters. ( #13750 )
2025-03-05 22:50:33 +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
70c9f3963c
Codechange: strongly type VehicleID
2025-02-16 14:50:15 +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
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