summaryrefslogtreecommitdiff
path: root/src/newgrf_industrytiles.cpp
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2011-06-12 20:38:46 +0000
committerterkhen <terkhen@openttd.org>2011-06-12 20:38:46 +0000
commitdc6218aa49101b3c0e20bd7e3da7ed05b7883b78 (patch)
treeba3120da6bbba2a955b63f26c113cf3b43a58d7b /src/newgrf_industrytiles.cpp
parentdd8a436cbb997968431554fa5b2406cee8fb97ac (diff)
downloadopenttd-dc6218aa49101b3c0e20bd7e3da7ed05b7883b78.tar.xz
(svn r22563) -Codechange: Use a function for storing values inside the persistent storage.
Diffstat (limited to 'src/newgrf_industrytiles.cpp')
-rw-r--r--src/newgrf_industrytiles.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index da72c41cf..c69c3b8cb 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -148,6 +148,19 @@ static void IndustryTileSetTriggers(const ResolverObject *object, int triggers)
}
}
+/**
+ * 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 IndustryTileStorePSA(ResolverObject *object, uint pos, int32 value)
+{
+ Industry *ind = object->u.industry.ind;
+ if (object->scope != VSG_SCOPE_PARENT || ind->index == INVALID_INDUSTRY) return;
+ ind->psa.Store(pos, value);
+}
+
static void NewIndustryTileResolver(ResolverObject *res, IndustryGfx gfx, TileIndex tile, Industry *indus)
{
res->GetRandomBits = IndustryTileGetRandomBits;
@@ -155,8 +168,8 @@ static void NewIndustryTileResolver(ResolverObject *res, IndustryGfx gfx, TileIn
res->SetTriggers = IndustryTileSetTriggers;
res->GetVariable = IndustryTileGetVariable;
res->ResolveReal = IndustryTileResolveReal;
+ res->StorePSA = IndustryTileStorePSA;
- res->psa = &indus->psa;
res->u.industry.tile = tile;
res->u.industry.ind = indus;
res->u.industry.gfx = gfx;