summaryrefslogtreecommitdiff
path: root/src/newgrf_house.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_house.cpp
parent7ffc8c0173cea7b364636e4a0686e72947095a9a (diff)
downloadopenttd-a619ad37897c6ee985aa7bb0dadbd9bbc47c5a63.tar.xz
(svn r22569) -Feature: [NewGRF] Persistent storage for towns.
Diffstat (limited to 'src/newgrf_house.cpp')
-rw-r--r--src/newgrf_house.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index fd0281e4e..1ec391c51 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -259,7 +259,7 @@ static uint32 HouseGetVariable(const ResolverObject *object, byte variable, byte
HouseID house_id = object->u.house.house_id;
if (object->scope == VSG_SCOPE_PARENT) {
- return TownGetVariable(variable, parameter, available, town);
+ return TownGetVariable(variable, parameter, available, town, object->grffile);
}
switch (variable) {
@@ -361,6 +361,21 @@ static const SpriteGroup *HouseResolveReal(const ResolverObject *object, const R
}
/**
+ * 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 HouseStorePSA(ResolverObject *object, uint pos, int32 value)
+{
+ /* Houses have no persistent storage. */
+ if (object->scope != VSG_SCOPE_PARENT || object->u.house.not_yet_constructed) return;
+
+ /* Pass the request on to the town of the house */
+ TownStorePSA(object->u.house.town, object->grffile, pos, value);
+}
+
+/**
* NewHouseResolver():
*
* Returns a resolver object to be used with feature 07 spritegroups.
@@ -372,6 +387,7 @@ static void NewHouseResolver(ResolverObject *res, HouseID house_id, TileIndex ti
res->SetTriggers = HouseSetTriggers;
res->GetVariable = HouseGetVariable;
res->ResolveReal = HouseResolveReal;
+ res->StorePSA = HouseStorePSA;
res->u.house.tile = tile;
res->u.house.town = town;