summaryrefslogtreecommitdiff
path: root/src/newgrf_station.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-03-21 20:58:01 +0000
committerpeter1138 <peter1138@openttd.org>2007-03-21 20:58:01 +0000
commite2801aa32046721d2da66c3bed7d6389be82b069 (patch)
tree2b9e35ba9948e4ae485e1928d9594d8fa0f66298 /src/newgrf_station.cpp
parentc29aa2ec44e67138fc384eaa63177bd2631f7530 (diff)
downloadopenttd-e2801aa32046721d2da66c3bed7d6389be82b069.tar.xz
(svn r9393) -Codechange: Use newgrf town resolver as station parent scope handler
Diffstat (limited to 'src/newgrf_station.cpp')
-rw-r--r--src/newgrf_station.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 2d7fc5c17..f964525c4 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -20,6 +20,8 @@
#include "date.h"
#include "helpers.hpp"
#include "cargotype.h"
+#include "town_map.h"
+#include "newgrf_town.h"
static StationClass station_classes[STAT_CLASS_MAX];
@@ -348,6 +350,22 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
const Station *st = object->u.station.st;
TileIndex tile = object->u.station.tile;
+ if (object->scope == VSG_SCOPE_PARENT) {
+ /* Pass the request on to the town of the station */
+ Town *t;
+
+ if (st != NULL) {
+ t = st->town;
+ } else if (tile != INVALID_TILE) {
+ t = GetTownByTile(tile);
+ } else {
+ *available = false;
+ return UINT_MAX;
+ }
+
+ return TownGetVariable(variable, parameter, available, t);
+ }
+
if (st == NULL) {
/* Station does not exist, so we're in a purchase list */
switch (variable) {