summaryrefslogtreecommitdiff
path: root/src/newgrf_station.cpp
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2011-06-12 20:50:03 +0000
committerterkhen <terkhen@openttd.org>2011-06-12 20:50:03 +0000
commita619ad37897c6ee985aa7bb0dadbd9bbc47c5a63 (patch)
tree95db697b7650bab2fadc89e43c2e5697bf6040b6 /src/newgrf_station.cpp
parent7ffc8c0173cea7b364636e4a0686e72947095a9a (diff)
downloadopenttd-a619ad37897c6ee985aa7bb0dadbd9bbc47c5a63.tar.xz
(svn r22569) -Feature: [NewGRF] Persistent storage for towns.
Diffstat (limited to 'src/newgrf_station.cpp')
-rw-r--r--src/newgrf_station.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 25dc06440..07ed47af8 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -275,7 +275,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
return UINT_MAX;
}
- return TownGetVariable(variable, parameter, available, t);
+ return TownGetVariable(variable, parameter, available, t, object->grffile);
}
if (st == NULL) {
@@ -517,6 +517,21 @@ static const SpriteGroup *StationResolveReal(const ResolverObject *object, const
}
+/**
+ * Store a value into the persistent storage of the object's parent.
+ * @param object Object that we want to query.
+ * @param pos Position in the persistent storage to use.
+ * @param value Value to store.
+ */
+void StationStorePSA(ResolverObject *object, uint pos, int32 value)
+{
+ /* Stations have no persistent storage. */
+ BaseStation *st = object->u.station.st;
+ if (object->scope != VSG_SCOPE_PARENT || st == NULL) return;
+
+ TownStorePSA(st->town, object->grffile, pos, value);
+}
+
static void NewStationResolver(ResolverObject *res, const StationSpec *statspec, BaseStation *st, TileIndex tile)
{
res->GetRandomBits = StationGetRandomBits;
@@ -524,6 +539,7 @@ static void NewStationResolver(ResolverObject *res, const StationSpec *statspec,
res->SetTriggers = StationSetTriggers;
res->GetVariable = StationGetVariable;
res->ResolveReal = StationResolveReal;
+ res->StorePSA = StationStorePSA;
res->u.station.st = st;
res->u.station.statspec = statspec;