summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkiwitreekor <kiwitreekor@gmail.com>2020-01-30 05:23:23 +0900
committerGitHub <noreply@github.com>2020-01-29 21:23:23 +0100
commit5df01bf95edc38bb43ce68f5a12f6c402436cf8b (patch)
tree25812c79c15329e57e66445260bdda7b0bfbf01a /src
parent2fee030a26996a167adbf28f96fca8c4fd749005 (diff)
downloadopenttd-5df01bf95edc38bb43ce68f5a12f6c402436cf8b.tar.xz
Add: [NewGRF] Station variable 6A, querying GRFID of nearby station tiles (#7956)
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_station.cpp10
-rw-r--r--src/table/newgrf_debug_data.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 312ca59d5..19f32bd75 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -368,6 +368,16 @@ TownScopeResolver *StationResolverObject::GetTown()
return res;
}
+ case 0x6A: { // GRFID of nearby station tiles
+ TileIndex nearby_tile = GetNearbyTile(parameter, this->tile);
+
+ if (!HasStationTileRail(nearby_tile)) return 0xFFFFFFFF;
+ if (!IsCustomStationSpecIndex(nearby_tile)) return 0;
+
+ const StationSpecList ssl = BaseStation::GetByTile(nearby_tile)->speclist[GetCustomStationSpecIndex(nearby_tile)];
+ return ssl.grfid;
+ }
+
/* General station variables */
case 0x82: return 50;
case 0x84: return this->st->string_id;
diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h
index c5ed48df4..d14415051 100644
--- a/src/table/newgrf_debug_data.h
+++ b/src/table/newgrf_debug_data.h
@@ -127,6 +127,7 @@ static const NIVariable _niv_stations[] = {
NIV(0x67, "land info of nearby tiles"),
NIV(0x68, "station info of nearby tiles"),
NIV(0x69, "information about cargo accepted in the past"),
+ NIV(0x6A, "GRFID of nearby station tiles"),
NIV_END()
};