This document describes the non-standard addition of the NewGRF road stops feature to the Official OpenTTD NewGRF Specifications, as implemented in this patchpack. This feature does not match OpenTTD PR #7955 in a number of key areas, this feature may not necessarily match implementations of NewGRF road stops in other patches, branches, etc. This feature as implemented here MAY also be present in other patchpacks.
See the NewGRF additions document for background information on additions to the NewGRF specifications.
A subset of the functionality listed below is also supported in a fork of NML, see the associated NML road stops and NML additions documents for more details.
NewGRFs which use this feature SHOULD use the feature testing mechanism to check whether the road stop feature and/or feature ID mapping is supported.
NewGRFs which use this feature MUST use the feature ID mapping mechanism to map the non-standard NewGRF road stop feature to a local feature ID.
This feature is indicated by the feature name: road_stops, version 1.
The feature name to use for feature ID mapping is road_stops.
Features/properties/variables which require a higher version will indicate the required version. Unless indicated otherwise these will fall back to doing nothing on versions which do not support them.
Sections:
See the Action 0 Specification for background information.
Properties:Number | Mappable name | Size in bytes | Description |
---|---|---|---|
08 | roadstop_class_id | 4 | Class ID |
09 | roadstop_stop_type | 1 | Stop type availability |
0A | roadstop_stop_name | 2 | Name |
0B | roadstop_class_name | 2 | Class name |
0C | roadstop_draw_mode | 1 | Draw mode |
0D | roadstop_random_trigger_cargoes | 4 | Random trigger cargoes |
0E | roadstop_animation_info | 2 | Animation info |
0F | roadstop_animation_speed | 1 | Animation speed |
10 | roadstop_animation_triggers | 2 | Animation triggers |
11 | roadstop_callback_mask | 1 | Callback flags |
12 | roadstop_general_flags | 4 | General flags |
13 | roadstop_min_bridge_height | 6 | Minimum bridge heights |
14 | roadstop_disallowed_bridge_pillars | 6 | Disallowed bridge pillars |
15 | roadstop_cost_multipliers | 2 | Cost multipliers |
16 | roadstop_height | 1 | Height (for build window) |
This property sets the road stop class ID for this road stop ID.
This property must be used first before any other property for this road stop ID.
Two class names are pre-defined:
Name | Class ID | Meaning |
---|---|---|
DFLT | 44 46 4C 54 | Default bus and lorry stops |
WAYP | 57 41 59 50 | This class is used for road waypoints |
This property sets the road stop type availability, this is ignored for road stops in the WAYP class.
The property length is 1 byte. The format is:
Value | Meaning |
---|---|
0 | Passenger/bus stop |
1 | Freight/lorry stop |
2 | Both passenger/bus and freight/lorry stops |
This property sets the road stop name string ID.
The property length is 2 bytes. This should be a D8xx or DCxx string ID.
This property sets the road stop class name string ID.
The property length is 2 bytes. This should be a D8xx or DCxx string ID.
This property sets the road stop draw mode.
The property length is 1 byte. The format is:
Bit | Value | Meaning |
---|---|---|
0 | 1 | Bay stops: Draw road type ground sprite |
1 | 2 | Drive through stops: Draw road/tram type overlays |
2 | 4 | Road waypoints: Draw sprite layout ground sprite on top of the underlying road (by default the sprite layout ground sprite is not used) |
This property sets the cargo types for random triggers.
This functions the same way as station (feature 4) property 12.
This sets which cargo types should trigger re-randomizing. The cargo types are given as a bitmask of the bits from column 3 (type B) in CargoTypes. If nothing is set (the default), the no random triggers will happen, to conserve CPU time.
With GRF version 7 and above, the interpretation of bits changes. Instead of climate-dependent cargo slot numbers (type B), you have to set the bits of climate-independent cargo ID (type A).
The property length is 4 bytes.
This property sets the cargo types for random triggers.
This functions the same way as station (feature 4) property 16.
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames.
The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use.
In addition, if the whole word contains FFFF, animation is turned off for this station (this is the default value). Since you can't have properties for individual station tiles, this property applies for every tile of the station.
If you don't want to animate some tiles, you should check the current position during callback 140 and return FD if the current tile doesn't need to be animated. If you also need animations of different length per tile, you'll have to use callback 141 for that.
The property length is 2 bytes.
This property sets the cargo types for random triggers.
This functions the same way as station (feature 4) property 17.
This is the amount of time between switching frames. The default value is 2, which means the switch occurs every 108 milliseconds. Increasing this value by one doubles the wait, i.e. 3 will cause 216 ms delay, while 4 will pause 432 ms, and so on.
The minimum is 0, which means the fastest possible animation, changing frames every game tick (27ms). The maximum is 16, which means 1769 seconds (approx. half an hour) delay. Settings above this value may cause strange behaviour.
The property length is 1 byte.
This property sets the cargo types for random triggers.
This functions the same way as station (feature 4) property 18.
This is a bit mask of events that should trigger callback 140, allowing to change the animation state.
Bit | Value | Meaning | Happens on | Var 18 |
---|---|---|---|---|
0 | 1 | Road stop is built | newly built tile | |
1 | 2 | New cargo arrives at station | all tiles | Bits 8..15 contain the triggering cargo type |
2 | 4 | Cargo removed from station | all tiles | Bits 8..15 contain the triggering cargo type |
3 | 8 | Road vehicle enters stop (starts loading/unloading) | tile where the vehicle is | |
4 | 10 | Road vehicle leaves stop (done loading/unloading) | tile where the vehicle is | |
5 | 20 | Road vehicle loads/unloads cargo | tile where the vehicle is | |
6 | 40 | Every 250 ticks | all tiles |
This property enables callbacks for this road stop type.
The property length is 1 byte. The format is:
Bit | Value | Variable 0C value | Callback |
---|---|---|---|
0 | 1 | 13 | Whether to make road stop available in construction window (non-zero callback return) or not (callback returns zero) |
1 | 2 | 141 | Decide next animation frame |
2 | 4 | 142 | Decide animation speed |
This property sets general flags for this road stop type.
The property length is 4 bytes. The format is:
Bit | Value | Meaning |
---|---|---|
0 | 1 | Callback 141 needs random bits in variable 10 |
1 | 2 | Do not show one way road overlay sprites, this should only be set if different graphics are provided for the different one-way states using bits 0..1 of variable 50. |
2 | 4 | Do not show catenary graphics.This requires road_stops, version 2. |
3 | 8 | Only allow drive-through stops (not bay stops).This requires road_stops, version 2. |
4 | 10 | Do not automatically build connecting road pieces.This requires road_stops, version 3. |
5 | 20 | Only show in the road build menu (not tram).This requires road_stops, version 4. |
6 | 40 | Only show in the tram build menu (not road).This requires road_stops, version 4. |
7 | 80 | Use custom graphics for disabled road stop views.This requires road_stops, version 8. |
8 | 100 | Read the road stop draw mode from variable 0x100, this overrides the roadstop_draw_mode property.This requires road_stops, version 9. |
This property allows or disallows building bridges over road stops.
The bridge height property defines minimum clearances required for a bridge for each of the 6 views/rotations (or 0 to not allow any bridge). Values are given in height level units (1 level == 8px).
Each height value is 1 byte, the total property length is 6 bytes.
This property describes which bridge pillars are not allowed on the road stop tile.
It consists of a set of pillar flags, for each of the 6 road stop views/rotations.
Each set of flags is 1 byte, the total property length is 6 bytes.
Each set of flags has the format described in the bridge_pillar_flags property section.
This property sets the build and removal cost multipliers.
The first byte is the build cost multiplier.
The second byte is the removal cost multiplier.
The total property length is 2 bytes.
A value of 16 produces a build or removal cost the same as non-NewGRF road stops..
This property sets the height used to size the road stop build window previews.
The nominal height for the road stop preview is set to at least: 32 + "value of this property" * 8.
This similar to Object variable 16.
The total property length is 1 byte.
This requires road_stops, version 6.
Views/rotation | Type | Description |
---|---|---|
0 | Bay | Facing north-east |
1 | Bay | Facing south-east |
2 | Bay | Facing south-west |
3 | Bay | Facing north-west |
4 | Drive-through | X-axis: north-east to south-west |
5 | Drive-through | Y-axis: north-west to south-east |
See the Action 2 Specification for background information.
Road stops use the special sprite layout format, the same as Action 2 features: 7 (house), 9 (industry tile), F (object), 11 (airport tile).
See the Variational Action 2 Specification for background information.
The parent scope for this feature is the road stop's station's town.
Variables:Number | Mappable name | Description |
---|---|---|
40 | roadstop_view | View/rotation |
41 | roadstop_type | Stop type |
42 | roadstop_terrain_type | Terrain type |
43 | roadstop_road_type | Road type |
44 | roadstop_tram_type | Tram type |
45 | roadstop_town_zone | Town zone and Manhattan distance of town |
46 | roadstop_town_distance_squared | Square of Euclidean distance of town |
47 | roadstop_company_info | Player/company info |
48 | Bitmask of accepted cargoes (BaseStation) | |
49 | roadstop_animation_frame | Current animation frame |
50 | roadstop_misc_info | Miscellaneous info |
60 | Amount of cargo waiting (BaseStation) | |
61 | Time since last cargo pickup (BaseStation) | |
62 | Rating of cargo (BaseStation) | |
63 | Time spent on route (BaseStation) | |
64 | Information about last vehicle picking cargo up (BaseStation) | |
65 | Amount of cargo acceptance (BaseStation) | |
66 | roadstop_animation_frame_nearby_tiles | Animation frame of nearby tile |
67 | roadstop_land_info_nearby_tiles | Land info of nearby tiles |
68 | roadstop_road_stop_info_nearby_tiles | Road stop info of nearby tiles |
roadstop_road_stop_info_nearby_tiles_v2 | Road stop info of nearby tiles (v2) | |
69 | Information about cargo accepted in the past (BaseStation) | |
6A | roadstop_road_stop_grfid_nearby_tiles | GRFID of nearby road stop tiles |
6B | roadstop_road_info_nearby_tiles | Road info of nearby plain road tiles |
Bits 0 - 7 have the range 0 - 5, see the 6 road stop views/rotations
The remaining bits are reserved for future use and should be masked.
Bits 0 - 7 have the values in the table below.
Value | Meaning |
---|---|
0 | Passenger/bus stop |
1 | Freight/lorry stop |
2 | Road waypoint |
This has the same value as bits 0 - 7 of object (feature F) variable 41.
Value | Meaning |
---|---|
0 | Normal |
1 | Desert |
2 | Rainforest |
4 | On or above snowline |
This has the value of the (translated) roadtype the road stop is built on, or the current roadtype in the build GUI. If the roadtype has no entry in the roadtype translation table of the GRF, this value will be 0xFF. If no translation table is present, the raw value will be returned. Note: only exact matches of roadtypes are reported. If the translation table of the GRF does not contain the exact roadtype 0xFF is returned.
If the tile has no road at all (tram only) 0xFFFFFFFF is returned.
This has the value of the (translated) tramtype the road stop is built on, or the current tramtype in the build GUI. If the tramtype has no entry in the tramtype translation table of the GRF, this value will be 0xFF. If no translation table is present, the raw value will be returned. Note: only exact matches of tramtypes are reported. If the translation table of the GRF does not contain the exact tramtype 0xFF is returned.
If the tile has no tram at all (road only) 0xFFFFFFFF is returned.
The town used is the one associated with the station/waypoint (this is in the station/waypoint name by default).
Bits | Meaning |
---|---|
0 - 15 | Manhattan distance from town |
16 - 24 | Town zone |
The town used is the one associated with the station/waypoint (this is in the station/waypoint name by default).
This has the same value as vehicle (features 0 - 3) variable 43.
The company used is the owner of the station/waypoint, not the owner of the underlying road and/or tram.
This has the same value as station (feature 4) variable 4A.
Bits | Meaning |
---|---|
0 - 1 |
One-way road information: 0 - Two-way traffic 1 - West-bound only 2 - East-bound only 3 - No entry |
2 - 3 |
Inferred one-way road information, from examining the road layout: 0 - Two-way traffic 1 - West-bound only 2 - East-bound only 3 - No entry This requires road_stops, version 8. |
4 |
1 if the road stop is being drawn in the build window This requires road_stops, version 9. |
This has the same value as station (feature 4) variable 66.
This has the same value as industry tile (feature 9) variable 60.
This has a similar value to station (feature 4) variable 68.
Bits | Meaning |
---|---|
0 - 7 |
If the tile is defined in the current GRF, this is the lower 8 bits of the setID used in the definition. Otherwise, the content is undefined. Note that if this GRF has any road stop setIDs greater than 255, bits 24 - 31 need to be used as well. |
8 - 9 |
0 - The tile uses original TTD graphics 1 - The tile is defined in the current GRF 2 - The tile is defined in another GRF |
10 | Set if the selected tile belongs to the current station, clear otherwise |
11 | Clear if the selected tile has the same view/rotation, set if a different view/rotation |
12 - 15 | View/rotation of the selected tile |
16 - 19 |
0 - Passenger/bus stop 1 - Freight/lorry stop 2 - Road waypoint |
20 | Set if the stop type (passenger/bus, freight/lorry or road waypoint) is the same as the current tile |
21 - 22 |
One-way road information of the selected tile: 0 - Two-way traffic 1 - North-bound only 2 - South-bound only 3 - No entry |
24 - 31 |
If the tile is defined in the current GRF, this is the upper 8 bits of the setID used in the definition. Otherwise, the content is undefined. This can be ignored if this GRF does not have any road stop setIDs greater than 255 (does not define more than 256 road stop types). This requires road_stops, version 7. |
This has a similar value to 68/roadstop_road_stop_info_nearby_tiles, above.
Bits | Meaning |
---|---|
0 - 15 | If the tile is defined in the current GRF, this is the setID used in the definition. Otherwise, the content is undefined. |
16 - 17 |
0 - The tile uses original TTD graphics 1 - The tile is defined in the current GRF 2 - The tile is defined in another GRF |
18 | Set if the selected tile belongs to the current station, clear otherwise |
19 | Clear if the selected tile has the same view/rotation, set if a different view/rotation |
20 - 23 | View/rotation of the selected tile |
24 - 27 |
0 - Passenger/bus stop 1 - Freight/lorry stop 2 - Road waypoint |
28 | Set if the stop type (passenger/bus, freight/lorry or road waypoint) is the same as the current tile |
29 - 30 |
One-way road information of the selected tile: 0 - Two-way traffic 1 - North-bound only 2 - South-bound only 3 - No entry |
This has the same value as station (feature 4) variable 6A.
Bits | Value | Meaning |
---|---|---|
0 | 01 | North-west road piece is present |
1 | 02 | South-west road piece is present |
2 | 04 | South-east road piece is present |
3 | 08 | North-east road piece is present |
4 | 10 | North-west tram piece is present |
5 | 20 | South-west tram piece is present |
6 | 40 | South-east tram piece is present |
7 | 80 | North-east tram piece is present |
8 - 15 |
Road piece and slope: (Same order as road sprites). 0 - 18: As above 0xFF: No road present | |
16 - 23 |
Tram piece and slope: (Same order as road sprites). 0 - 18: As above 0xFF: No tram present |
See the Random Action 2 Specification for background information.
Road stops have 16+8 random bits. Bits 0 to 15 are a property of the station as a whole, and bits 16 to 23 are different for each tile.
Bit | Value | Trigger |
---|---|---|
0 | 01 | New cargo waiting |
1 | 02 | No more cargo |
2 | 04 | Road vehicle arrives (starts unloading/loading) |
3 | 08 | Road vehicle leaves (done unloading & loading) |
4 | 10 | Road vehicle loads or unloads cargo |
Also note that none of the above triggers will actually trigger unless property 0D/roadstop_random_trigger_cargoes has at least one bit set.
Triggers 01 will be triggered for any of the cargo types set in property 0D/roadstop_random_trigger_cargoes, but trigger 02 will only be triggered if all of those cargo types have no more cargo waiting.
Triggers 04 and 08 are triggered no matter what cargo types the train transports, as long as property 0D/roadstop_random_trigger_cargoes is not zero.
Triggers 04, 08, and 10 only affect the tile on which they occur, as well as the random bits of the station, but not other tiles.
See the Action 3 Specification for background information.
Road stops have the same Action 3 cargo-type values as feature 4 (station).
In feature name road_stops version 7 and later, the Action 3 ID field is an extended byte; GRFs may define more than 255 road stop types.
In versions 1 to 6 (inclusive), only 255 road stop types may be defined per GRF, and the extended byte format may not be used.
In feature name road_stops versions 1 to 5 (inclusive), mapped Action 0 properties which are unknown and should be ignored, instead generate an error on use.