Commit Graph

449 Commits

Author SHA1 Message Date
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
Peter Nelson 484ed1008a Codechange: Make TownRatingCheckType an enum class. (#14652) 2025-09-23 22:00:34 +01:00
Rubidium 7c0f69a8fe Codefix: typos in comments and strings 2025-08-31 10:30:37 +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 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 aa9e5b38cd Codechange: Use DiagDirections when drawing level crossings. 2025-05-07 17:31:29 +01:00
frosch 8571af9833 Codechange: Turn ZoomLevel into enum class. 2025-05-03 23:21:09 +02:00
Peter Nelson 2c4897c2cd Codechange: Use EnumBitSet for HouseZones. (#14137) 2025-04-28 20:27:43 +01:00
frosch 2bee313642 Codechange: Replace FindVehicleOnPos with 'for' loop. 2025-04-22 22:12:59 +02:00
frosch 2a62eea005 Codefix: Comment style. (#14064) 2025-04-21 17:25:09 +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
frosch 7cbf4f5560 Codechange: Expand the single usage of the macro CLRBITS. 2025-04-18 17:16:48 +02:00
frosch 42deccc4f5 Codechange: Merge (IsOn|Toggle)(Snow|Desert) into (IsOn|Toggle)SnowOrDesert. 2025-04-18 16:33:26 +02:00
frosch 252376ce3e Codechange: Rename DrawRoadAsSnowDesert to DrawRoadAsSnowOrDesert to be consistent with other functions. 2025-04-18 16:33:26 +02:00
Richard Wheeler a93087ec5c Fix #13980: Allow diagonal selection for road convert (#13983)
Fixes #13980
2025-04-12 18:50:11 +01:00
Kuhnovic 319a657454 Fix 42fbcec76f41: 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 732109e444 Codechange: Use EnumBitSet for RoadTypes. 2025-03-25 20:15:48 +00:00
Peter Nelson 819e097d6e Codechange: Use separate RoadTypes mask to list road or tram roadtypes.
This simplifies logic reduces ambiguity.
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 21d2a94809 Codechange: Use EnumBitSet for GrfMiscBits. (#13873) 2025-03-22 21:07:59 +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
Rubidium 02f1bc0880 Codefix: remove some logically dead code 2025-03-12 22:00:33 +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 a2accbccc3 Fix #13703: Don't set error owner for town-originated errors. (#13705) 2025-03-02 21:59:55 +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 fd4adc55e3 Codechange: replace INVALID_X with XID::Invalid() for PoolIDs 2025-02-16 20:23:00 +01:00
Rubidium ab8177ea77 Codechange: strongly type CompanyID 2025-02-16 14:02:18 +01:00
Peter Nelson 2d7d085e8e Codechange: Use EncodedString for error messages. (#13569) 2025-02-16 10:04:32 +00: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
Peter Nelson d22fd78b1c Codefix: Sprite offsets and counts are not SpriteIDs. (#13336) 2025-01-19 15:58:13 +00:00
Rubidium 0aa9faf187 Codechange: use INVALID_TOWN instead of 0 to denote 'not applicable' 2025-01-19 16:54:42 +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
SamuXarick 10e2d1ca36 Codechange: Use Map::Iterate() to iterate tiles 2024-12-06 10:33:11 +10:00
SamuXarick d5a13fb9f4 Codechange: Use TileOffsByAxis(...) in more places (#13026) 2024-10-24 15:58:15 -04:00
Rubidium c9819f8957 Codechange: split GetRoadDir as bays have DiagDir and drive throughs have Axis 2024-10-24 20:40:32 +02:00
Jonathan G Rennison c35a5e5cb1 Change: Add variable ground types for road waypoints 2024-06-24 22:12:08 +02:00
Jonathan G Rennison 9c84e5df3f Add: Road waypoint functionality 2024-06-24 22:12:08 +02:00
Tyler Trahan 4cbaac6dac Fix #10239: Use elevated snow height for roads on flat foundations (#12776) 2024-06-15 17:10:39 -04: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 27eadc13ec Codechange: rename TILE_ADD(XY) to TileAdd(XY) 2024-03-10 15:50:24 +01:00