Commit Graph

1069 Commits

Author SHA1 Message Date
Peter Nelson
8aade54f66 Fix #14921: Crash during station autorefit if station doesn't accept current cargo type. (#14924)
Add convenience helpers to correctly retrieve goods entry cargo available/totals.

Avoids having to check if cargo data is available before accessing it, which was missing for autorefit.
2025-12-21 02:03:50 +05:00
Peter Nelson
a3db9e7e80 Fix #14871, 80e58e751a: Possible crash when building NewGRF station under bridge. (#14872)
Triggered by reading random tile data before the tile is actually created.
2025-12-08 22:28:27 +05:00
Cyprian Klimaszewski
add6521abd Doc: Update information for receiving a copy of GPL. (#14869) 2025-12-08 22:26:18 +05:00
Rubidium
c60378a0eb Fix #14802: close NewGRF inspection window when overbuilding with default station/waypoint 2025-12-08 21:36:43 +05:00
Richard Wheeler
18649c800b Fix: Bridge deck sprites were not toyland aware (#14821) 2025-12-08 21:29:33 +05:00
Peter Nelson
f0d0bf4447 Codechange: Use enum class for water-related enums. (#14804) 2025-12-08 21:09:43 +05:00
davidxn
05284ba193 Fix 741c431: Miscalculated cargo penalty for poor station rating (#14712) 2025-12-08 20:46:54 +05:00
Peter Nelson
0112fa8ce3 Codechange: Use enum class for Roadside. 2025-12-08 20:42:04 +05:00
Rito12
3a7260c2d6 Add: Show height difference in bridge is too low error message. (#14614) 2025-12-08 19:58:55 +05:00
Peter Nelson
57e48db628 Codechange: Remove StationIDStack and SmallStack.
Use a std::vector or std::span instead.
2025-12-08 19:54:33 +05:00
Rubidium
892c02dc86 Codefix: shadowing of variables 2025-12-08 16:48:23 +05:00
Peter Nelson
2af7a99984 Fix #14607: Bridge-over-station discrepancy depending on build order. (#14608)
When building a custom station, the callback-derived tile layout is ignored during the bridge height test. This caused a discrepancy between building a station under a bridge vs building a bridge over the same station.

Test the station tile layout callback during the bridge height test.
2025-12-08 16:41:12 +05:00
Peter Nelson
2c9ac37b62 Fix #14631, Fix 1cb0cbcb6c: Waypoint customs spec not allocated properly on initial construction. (#14633)
Split AllocateSpecToStation/RoadStop into Allocate and Assign functions, allowing command tests to occur separately.
2025-12-08 15:53:20 +05:00
Tyler Trahan
99df8b41e6 Doc: Update station rating comments and doxygen. 2025-12-08 15:53:11 +05:00
Tyler Trahan
415bbb00c4 Codechange: Early continue for cargos not moved by this station 2025-12-08 15:53:06 +05:00
Peter Nelson
5833ac7497 Change: Allow bridges over docks. (#14594) 2025-12-08 15:36:15 +05:00
Peter Nelson
676de198bd Fix #14586, Fix 069ff846e4: Empty station tile layouts incorrectly substituted with default layouts. (#14587)
It is no longer possible for a layout to be missing, so the nullptr check should have been removed.
2025-12-08 15:35:59 +05:00
dP
8404c2a7cc Merge remote-tracking branch 'upstream/master' 2025-09-28 02:33:49 +05:00
Rubidium
4fb749886a Codefix: typos in variable/constant/function names 2025-08-31 10:30:37 +02:00
Peter Nelson
54f328beeb Codechange: Remove output pointer from GetTileArea(). (#14530)
This simplifies things and removes undocumented type `ETileArea`
2025-08-22 21:27:31 +01:00
Peter Nelson
9a294ab2ed Feature: Allow stations and roadstops under bridges.
Bridges above stations will have pillars excluded if they conflict with the station layout.

Partly based on the system implemented in JGRPP.

Co-authored-by: <su@angel-island.zone>
2025-08-20 21:40:41 +01: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
1cb0cbcb6c Codechange: Standardise how AllocateSpecToStation/RoadStop are called. (#14525)
Replace use of negative value with std::optional and update doxygen.
2025-08-19 18:52:36 +01:00
Peter Nelson
376b2f42c9 Fix 0878f71051: Incorrect station layout for even platform counts. (#14515) 2025-08-13 23:18:26 +01:00
Peter Nelson
0878f71051 Codechange: Add RailStationTileLayout iterator. (#14510)
This allows iterating a predefined or calculated rail station layout without allocating extra memory and copying.
2025-08-13 17:23:19 +01:00
Peter Nelson
1ccbd735d8 Codechange: Extract function to draw custom rail station foundations. (#14492) 2025-08-06 23:46:53 +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
Jonathan G Rennison
f0447d59d4 Codechange: Use StationID as StationIDStack Titem type 2025-07-20 16:06:03 +02:00
Peter Nelson
b2de1ff66f Fix #14433: Broken road stop drawing due to incorrect modes conversion. (#14434)
The mask was treated as a single RoadStopDrawMode instead of a RoadStopDrawModes bitset.
2025-07-14 17:25:53 +01:00
Peter Nelson
5766ba51d7 Codefix: Clean up incorrect indentation for multi-line comments. (#14383) 2025-06-20 19:01:44 +01:00
dP
f0f93c68ca Merge remote-tracking branch 'upstream/master' 2025-06-14 17:01:17 +05:00
Jonathan G Rennison
63f1c2aa3a Codechange: Use TypedIndexContainer for typed index containers
Instead of ReferenceThroughBaseContainer
2025-06-12 18:50:49 +01:00
Peter Nelson
7c9393e822 Codechange: Remove terminator from airport tile lists. (#14306) 2025-05-27 20:23:59 +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
dP
df3a6e321f Merge remote-tracking branch 'upstream/master' 2025-05-14 18:41:13 +05:00
Peter Nelson
a7019b859c Codechange: Use DiagDirections when checking for flat buildable tiles. 2025-05-07 17:31:29 +01:00
frosch
6faa667644 Codechange: Remove global GetRegister(), instead return 100+ registers directly from GetXxxCallback(). 2025-05-06 22:24:41 +02:00
frosch
74030a63e6 Codechange: Move SpriteLayoutProcessor's operations closer to the ResolverObject. 2025-05-06 22:24:41 +02:00
frosch
8bbfbd0347 Codechange: Move spritelayout preprocessing to a separate class, which owns the heap allocations involved. 2025-05-06 18:30:42 +02:00
frosch
d9c43e7fda Codechange: Make TileLayoutSpriteGroup::ProcessRegisters return a DrawTileSpriteSpan on the stack, instead of a reference to a global. 2025-05-06 18:30:42 +02:00
frosch
0d5b3ebd7f Codechange: Declare all IntervalTimers const, which can be const. 2025-05-06 18:29:41 +02:00
Peter Nelson
b06273f716 Codechange: Use FlatSet when searching tiles around stations. 2025-05-05 14:00:38 +01:00
Peter Nelson
2c4897c2cd Codechange: Use EnumBitSet for HouseZones. (#14137) 2025-04-28 20:27:43 +01:00
frosch
b7e7f08f78 Codechange: Simplify usage of GRFFileProps by adding some common helper methods. 2025-04-28 13:44:46 +02:00
frosch
f62f728187 Codechange: Move usage of ResolverObjects to newgrf_xxx.cpp (#14116) 2025-04-26 20:53:50 +02:00
frosch
1ea1dbd19e Add: [NewGRF] Station/roadstop animation-triggers 'tile loop' (bit 7) and 'path reservation' (bit 8). (#14080) 2025-04-26 14:44:55 +02:00
frosch
2bee313642 Codechange: Replace FindVehicleOnPos with 'for' loop. 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
f399b8eb29 Codechange: Unify naming of NewGRF animation callbacks. 2025-04-21 19:06:13 +02:00