Skip to content

Commit

Permalink
Add: [NewGRF] Station variable 6A, querying GRFID of nearby station t…
Browse files Browse the repository at this point in the history
…iles (OpenTTD#7956)
  • Loading branch information
kiwitreekor authored and douiwby committed Apr 16, 2020
1 parent 42b9ba8 commit 2e7964e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/newgrf_station.cpp
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/table/newgrf_debug_data.h
Expand Up @@ -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()
};

Expand Down

0 comments on commit 2e7964e

Please sign in to comment.