diff --git a/docs/newgrf-roadstops-nml.html b/docs/newgrf-roadstops-nml.html index 90997bfa02..9c31a12eda 100644 --- a/docs/newgrf-roadstops-nml.html +++ b/docs/newgrf-roadstops-nml.html @@ -119,6 +119,7 @@ animation_frame0..255Animation frame of the current tile waiting_triggers0..255Waiting triggers random_bits0..16777215Random bits + one_way_infoRST_OWI_XXXOne-way road information of drive-through stop tile
XXX = TWO_WAY | NORTH_BOUND | SOUTH_BOUND | NO_ENTRY
Variables that require one or more parameters: @@ -142,6 +143,7 @@ nearby_tile_viewx, y offset (-8..7)0..5The view/rotation of a nearby road stop tile nearby_tile_stop_typex, y offset (-8..7)RST_TYPE_XXXSee stop_type nearby_tile_same_stop_typex, y offset (-8..7)0 | 1Is the stop type of a nearby road stop tile the same as this tile? + nearby_tile_one_way_infox, y offset (-8..7)RST_OWI_XXXOne-way state of nearby drive-through road stop tile nearby_tile_road_stop_infox, y offset (-8..7)Above nearby road stop tile variables in one variable (all of variable 0x68) nearby_tile_grfidx, y offset (-8..7)-1, 0 or a GRFIDReturn value is -1 if the tile is not a road stop, 0 if the tile is a non-custom road stop, or else the GRFID of the NewGRF defining the road stop diff --git a/docs/newgrf-roadstops.html b/docs/newgrf-roadstops.html index 5816e3ce2f..903dbadbaa 100644 --- a/docs/newgrf-roadstops.html +++ b/docs/newgrf-roadstops.html @@ -208,6 +208,7 @@ 47roadstop_company_infoPlayer/company info 48Bitmask of accepted cargoes (BaseStation) 49roadstop_animation_frameCurrent animation frame + 50roadstop_misc_infoMiscellaneous info 60Amount of cargo waiting (BaseStation) 61Time since last cargo pickup (BaseStation) 62Rating of cargo (BaseStation) @@ -269,6 +270,22 @@

Current animation frame (49, or mappable variable: roadstop_animation_frame)

This has the same value as station (feature 4) variable 4A.

+

Miscellaneous road stop info (50, or mappable variable: roadstop_misc_info)

+

The town used is the one associated with the station/waypoint (this is in the station/waypoint name by default). + + + +
BitsMeaning
0 - 1 + One-way road information:
+ 0 - Two-way traffic
+ 1 - North-bound only
+ 2 - South-bound only
+ 3 - No entry +
+
+ The remaining bits are reserved for future use and should be masked. +

+

Animation frame of nearby tile (66, or mappable variable: roadstop_animation_frame_nearby_tiles)

This has the same value as station (feature 4) variable 66.

@@ -295,6 +312,12 @@ 2 - Road waypoint 20Set 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
The remaining bits are reserved for future use and should be masked. diff --git a/src/newgrf_extension.cpp b/src/newgrf_extension.cpp index af67203680..74ddbb1275 100644 --- a/src/newgrf_extension.cpp +++ b/src/newgrf_extension.cpp @@ -120,6 +120,7 @@ extern const GRFVariableMapDefinition _grf_action2_remappable_variables[] = { GRFVariableMapDefinition(GSF_ROADSTOPS, 0x46, "roadstop_town_distance_squared"), GRFVariableMapDefinition(GSF_ROADSTOPS, 0x47, "roadstop_company_info"), GRFVariableMapDefinition(GSF_ROADSTOPS, 0x49, "roadstop_animation_frame"), + GRFVariableMapDefinition(GSF_ROADSTOPS, 0x50, "roadstop_misc_info"), GRFVariableMapDefinition(GSF_ROADSTOPS, 0x66, "roadstop_animation_frame_nearby_tiles"), GRFVariableMapDefinition(GSF_ROADSTOPS, 0x67, "roadstop_land_info_nearby_tiles"), GRFVariableMapDefinition(GSF_ROADSTOPS, 0x68, "roadstop_road_stop_info_nearby_tiles"), diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp index c0045dab47..041804454e 100644 --- a/src/newgrf_roadstop.cpp +++ b/src/newgrf_roadstop.cpp @@ -121,6 +121,15 @@ uint32 RoadStopScopeResolver::GetVariable(uint16 variable, uint32 parameter, Get /* Animation frame */ case 0x49: return this->tile == INVALID_TILE ? 0 : this->st->GetRoadStopAnimationFrame(this->tile); + /* Misc info */ + case 0x50: { + uint32 result = 0; + if (this->tile != INVALID_TILE) { + if (IsDriveThroughStopTile(this->tile)) result |= GetDriveThroughStopDisallowedRoadDirections(this->tile); + } + return result; + } + /* Variables which use the parameter */ /* Variables 0x60 to 0x65 and 0x69 are handled separately below */ @@ -160,6 +169,9 @@ uint32 RoadStopScopeResolver::GetVariable(uint16 variable, uint32 parameter, Get const RoadStopSpecList ssl = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)]; res |= 1 << (ssl.grfid != grfid ? 9 : 8) | ssl.localidx; } + if (IsDriveThroughStopTile(nearby_tile)) { + res |= (GetDriveThroughStopDisallowedRoadDirections(nearby_tile) << 21); + } return res; } diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 5e3f70ac37..1558f13873 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -1391,6 +1391,7 @@ static const NIVariable _nif_roadstops[] = { NIV(0x47, "player info"), NIV(0x48, "bitmask of accepted cargoes"), NIV(0x49, "current animation frame"), + NIV(0x50, "miscellaneous info"), NIV(0x60, "amount of cargo waiting"), NIV(0x61, "time since last cargo pickup"), NIV(0x62, "rating of cargo"),