1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2025-12-10 06:52:05 +01:00
Commit Graph

496 Commits

Author SHA1 Message Date
Rubidium
1445aa9543 Codefix: some coding style improvements 2025-12-06 12:07:53 +01:00
Peter Nelson
2851c70a59 Codechange: Use enum class for RailGroundType. 2025-11-17 20:46:05 +00:00
Peter Nelson
0f5a4290df Codechange: Use enum class for RailTileType 2025-11-17 20:46:05 +00:00
Peter Nelson
29136350cf Codechange: Initialise rail/road types with range-for.
Replace double loop with single loop that performs both parts together.
2025-09-28 19:27:47 +01:00
Peter Nelson
ca8fb69ffd Codechange: Use std algorithm when allocating rail/road type.
Use `std::ranges::find()` instead of a `for`-loop to allocate rail and road types.
2025-09-28 19:27:47 +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
f30f808b50 Codechange: Implement tile proc handler to test for building bridge over tile. 2025-08-20 21:40:41 +01:00
Peter Nelson
0a1c0b8b48 Change: Hide bridge pillars if obstructed by tile below.
Tiles can now control if pillars are drawn on a bridge above it. There is no visible change with default bridges.
2025-08-15 23:20:18 +01:00
Peter Nelson
980121cdf5 Codefix: Don't store palette for track detail in temporary global variable. (#14516)
Pass palette via parameters instead.
2025-08-14 12:28:36 +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
87544eff0c Codechange: Use DiagDirections to collect rail fence data. 2025-05-07 17:31:29 +01:00
frosch
61cec33be2 Codechange: Add 'const' to static variables, which are only initialised once. 2025-05-06 18:29:41 +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
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
cde350dc01 Codechange: Replace macros GENERAL_SPRITE_COLOUR and COMPANY_SPRITE_COLOUR with functions GetColourPalette and GetCompanyPalette. 2025-04-18 23:41:37 +02:00
Kuhnovic
319a657454 Fix 42fbcec76f: Fixed accidental changes to autorail/road AI behavior (#13968)
* Revert 4bd72e4a78, Fix #11528: Starting autorail dragging from existing track tiles resulted in adding non-continuous tracks.

* Fix 4bd72e4a78: Fixed accidental changes to autorail/road AI behavior
2025-04-12 16:09:10 +02:00
Kuhnovic
4bd72e4a78 Fix #11528: Starting autorail dragging from existing track tiles resulted in adding non-continuous tracks. (#13885) 2025-04-04 15:21:04 +00:00
Peter Nelson
47d078c033 Codechange: Use EnumBitSet for RailTypes. 2025-03-25 20:15:48 +00:00
Peter Nelson
adb20f99ea Fix: Autoreplace rail/road list only listed buildable types. (#13887)
Instead list all possible types which includes hidden types compatible with buildable types.
2025-03-25 08:22:30 +00:00
Peter Nelson
17f7d0950e Fix #13838: Formatted error message of sub-errors may be lost. (#13840) 2025-03-18 08:39:40 +00:00
Rubidium
5ea5855677 Codechange: use std::move over copying where applicable 2025-03-16 17:33:06 +01: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
96f260e718 Codechange: Pass TileDesc by reference. 2025-02-23 23:00:51 +00:00
Rubidium
0449dc48c8 Codechange: explicitly initialise Depot member variables 2025-02-18 07:21:04 +01:00
Rubidium
c3d5e6d2a0 Codechange: Use EnumBitSet for DoCommandFlags 2025-02-14 00:28:57 +01:00
Peter Nelson
59354576d4 Codechange: Use EnumBitSet for LandscapeTypes and remove LandscapeID. (#13436) 2025-02-01 23:09:18 +00:00
Peter Nelson
917d5cc75d Codechange: Use EnumBitSet for RoadTypeFlags and RailTypeFlags. (#13415) 2025-01-30 22:08:51 +00:00
SamuXarick
610026ef17 Fix: Missing water region invalidation after flooding a half tile with rail in the highest corner
Invalidate water region when any flood occurs.
Convert a few magic numbers to their names.
2025-01-17 18:13:51 +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
bef11941c6 Change: Allow rail and road depot overbuilding in current orientation in order to connect to rail or road 2024-04-23 13:11:31 +02:00
Patric Stout
a3cfd23cf9 Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Rubidium
bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 2024-03-10 10:14:20 +01:00
rubidium42
e0e0d5f8fb Revert #11606: Don't auto-build past tunnelbridge ends
This reverts commit 59f6c199bf.
2024-03-09 15:54:50 +01:00
Michael Lutz
8b9f59d320 Codechange: Use references for non-optional in/out values of slope functions 2024-03-08 18:08:55 +01:00
Michael Lutz
8dda387f82 Codechange: Use std::tuple for slope functions with two return values 2024-03-08 18:08:55 +01:00
Patric Stout
48e7dceb3c Revert: Build signals to the next junction when dragging regardless of the Ctrl state (#12034)
This reverts commit b370ae1212.
2024-02-09 19:34:03 +01:00
Charles Pigott
59f6c199bf Fix #11528: Don't auto-build past tunnelbridge ends (#11606) 2024-02-03 11:18:10 +01:00
frosch
b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
frosch
e0bd1dd42e Codechange: replace a macro with a lambda. 2024-01-30 23:43:42 +01:00
dP
b370ae1212 Change: Build signals to the next junction when dragging regardless of the Ctrl state (#9637) 2024-01-30 19:14:26 +01:00
dP
acaceb45ba Codechange: Make command constant names consistent with command proc (#11920) 2024-01-29 13:41:36 +01:00
Tyler Trahan
68814bd912 Codechange: Rename SIGTYPE_NORMAL to SIGTYPE_BLOCK (#11788) 2024-01-15 15:27:48 -05:00
Peter Nelson
938c8339d2 Codechange: Ensure space between for/if and (. 2023-11-09 20:15:38 +00:00
Peter Nelson
ab535c0a86 Codechange: Add base() method to StrongType to allow access to the base type without casting. (#11445)
This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
2023-11-06 20:29:35 +00:00
frosch
5733145c59 Cleanup: Remove unneeded parameters. 2023-09-19 22:49:59 +02:00
frosch
b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
PeterN
acd7d3c913 Codechange: Rename *Railtype* to *RailType* for consistency. (#11287) 2023-09-11 08:55:12 +00:00
PeterN
a0b2f28f9c Codechange: Use std::copy/fill pattern to initialize rail and road specs. (#11285)
This avoids use of lengthof and array indices.
2023-09-10 23:01:08 +00:00
mrmbernardi
a5c8365aa4 Feature: Setting to disallow level crossings with competitors (#10755) 2023-09-02 12:46:24 +02:00