summaryrefslogtreecommitdiff
path: root/src/newgrf_industries.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-07-29 19:51:30 +0000
committerfrosch <frosch@openttd.org>2008-07-29 19:51:30 +0000
commitd791f3486de458ad94f631701be05d11eaca70fc (patch)
tree83db2fa5b6973b37ce41fee1714eb9c2abe7491a /src/newgrf_industries.cpp
parentdc2568325579ea42222df3bdda7075b4c0dfbe08 (diff)
downloadopenttd-d791f3486de458ad94f631701be05d11eaca70fc.tar.xz
(svn r13868) -Fix: Parent scope of industry variables.
Diffstat (limited to 'src/newgrf_industries.cpp')
-rw-r--r--src/newgrf_industries.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 68739f9ca..16a36dc6a 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -210,6 +210,23 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte par
IndustryType type = object->u.industry.type;
const IndustrySpec *indspec = GetIndustrySpec(type);
+ /* Shall the variable get resolved in parent scope and are we not yet in parent scope? */
+ if (object->u.industry.gfx == INVALID_INDUSTRYTILE && object->scope == VSG_SCOPE_PARENT) {
+ /* Pass the request on to the town of the industry */
+ const Town *t;
+
+ if (industry != NULL) {
+ t = industry->town;
+ } else if (tile != INVALID_TILE) {
+ t = ClosestTownFromTile(tile, UINT_MAX);
+ } else {
+ *available = false;
+ return UINT_MAX;
+ }
+
+ return TownGetVariable(variable, parameter, available, t);
+ }
+
if (industry == NULL) {
/* industry does not exist, only use those variables that are "safe" */
switch (variable) {