From 39247b012078b60cd1f17397e4e7baf269fe32dd Mon Sep 17 00:00:00 2001
From: Jonathan G Rennison
Date: Sun, 15 Oct 2023 22:27:28 +0100
Subject: [PATCH] Road stops: Add tile slope to varact2 variable 0x42
---
docs/newgrf-roadstops.html | 8 ++++++--
src/newgrf_extension.cpp | 2 +-
src/newgrf_roadstop.cpp | 2 +-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/docs/newgrf-roadstops.html b/docs/newgrf-roadstops.html
index 872651a5139..1c6da7de97b 100644
--- a/docs/newgrf-roadstops.html
+++ b/docs/newgrf-roadstops.html
@@ -261,13 +261,17 @@ Road stop type (41, or mappable variable: roadstop_type)<
Road stop tile terrain type (42, or mappable variable: roadstop_terrain_type)
- This has the same value as bits 0 - 7 of object (feature F) variable 41.
+
This has the same value as bits 0 - 15 of object (feature F) variable 41.
- Value | Meaning |
+ Bit | Meaning |
0 | Normal |
1 | Desert |
2 | Rainforest |
4 | On or above snowline |
+ 8 - 15 |
+ Tile slope
+ This requires road_stops, version 10.
+ |
diff --git a/src/newgrf_extension.cpp b/src/newgrf_extension.cpp
index 518f0dd65b4..f8d9ba72c9d 100644
--- a/src/newgrf_extension.cpp
+++ b/src/newgrf_extension.cpp
@@ -62,7 +62,7 @@ extern const GRFFeatureInfo _grf_feature_list[] = {
GRFFeatureInfo("action0_object_flood_resistant", 1),
GRFFeatureInfo("action0_object_viewport_map_tile_type", 1),
GRFFeatureInfo("varaction2_airporttiles_airport_info", 1),
- GRFFeatureInfo("road_stops", 9, GFTOF_ROAD_STOPS),
+ GRFFeatureInfo("road_stops", 10, GFTOF_ROAD_STOPS),
GRFFeatureInfo("new_landscape", 2),
GRFFeatureInfo("more_objects_per_grf", 1),
GRFFeatureInfo("more_action2_ids", 1, GFTOF_MORE_ACTION2_IDS),
diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp
index 2faf2bce6d1..aa8f9d498b3 100644
--- a/src/newgrf_roadstop.cpp
+++ b/src/newgrf_roadstop.cpp
@@ -130,7 +130,7 @@ uint32 RoadStopScopeResolver::GetVariable(uint16 variable, uint32 parameter, Get
return 2;
/* Terrain type */
- case 0x42: return this->tile == INVALID_TILE ? 0 : GetTerrainType(this->tile, TCX_NORMAL); // terrain_type
+ case 0x42: return this->tile == INVALID_TILE ? 0 : (GetTileSlope(this->tile) << 8 | GetTerrainType(this->tile, TCX_NORMAL));
/* Road type */
case 0x43: return get_road_type_variable(RTT_ROAD);