diff --git a/docs/newgrf-roadstops.html b/docs/newgrf-roadstops.html
index a2ad4fdb91..fa52e667fe 100644
--- a/docs/newgrf-roadstops.html
+++ b/docs/newgrf-roadstops.html
@@ -215,16 +215,19 @@
Road stop view/rotation (40, or mappable variable: roadstop_view)
- This has the range 0 - 5, see the 6 road stop views/rotations
+ 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.
Road stop type (41, or mappable variable: roadstop_type)
-
+
Bits 0 - 7 have the values in the table below.
Value | Meaning |
0 | Passenger/bus stop |
1 | Freight/lorry stop |
2 | Road waypoint |
+
+ The remaining bits are reserved for future use and should be masked.
Road stop tile/terrain type (42, or mappable variable: roadstop_terrain_type)
@@ -245,6 +248,8 @@
0 - 15 | Manhattan distance from town |
16 - 24 | Town zone |
+
+ The remaining bits are reserved for future use and should be masked.
Square of Euclidean distance of town (46, or mappable variable: roadstop_town_distance_squared)
@@ -276,8 +281,16 @@
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 |
- 14 - 12 | View/rotation of the selected tile |
+ 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 |
+
+ The remaining bits are reserved for future use and should be masked.
GRFID of nearby road stop tile (6A, or mappable variable: roadstop_road_stop_grfid_nearby_tiles)
diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp
index 920ab595e1..c0045dab47 100644
--- a/src/newgrf_roadstop.cpp
+++ b/src/newgrf_roadstop.cpp
@@ -151,6 +151,10 @@ uint32 RoadStopScopeResolver::GetVariable(uint16 variable, uint32 parameter, Get
bool same_orientation = GetStationGfx(this->tile) == GetStationGfx(nearby_tile);
bool same_station = GetStationIndex(nearby_tile) == this->st->index;
uint32 res = GetStationGfx(nearby_tile) << 12 | !same_orientation << 11 | !!same_station << 10;
+ StationType type = GetStationType(nearby_tile);
+ if (type == STATION_TRUCK) res |= (1 << 16);
+ if (type == STATION_ROADWAYPOINT) res |= (2 << 16);
+ if (type == this->type) SetBit(res, 20);
if (IsCustomRoadStopSpecIndex(nearby_tile)) {
const RoadStopSpecList ssl = BaseStation::GetByTile(nearby_tile)->roadstop_speclist[GetCustomRoadStopSpecIndex(nearby_tile)];