summaryrefslogtreecommitdiff
path: root/src/newgrf_industries.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2008-07-30 18:23:12 +0000
committerfrosch <frosch@openttd.org>2008-07-30 18:23:12 +0000
commit93d0ca873163cee121cc481357670c06b5cccde2 (patch)
treee8219f143ce84fdcf02b32f82e184cc7e156023d /src/newgrf_industries.cpp
parent515b55c635199db71a41ff2bd9959b9844d0dfa1 (diff)
downloadopenttd-93d0ca873163cee121cc481357670c06b5cccde2.tar.xz
(svn r13885) -Fix [FS#2168]: Var 0x7F is not feature-specific.
Diffstat (limited to 'src/newgrf_industries.cpp')
-rw-r--r--src/newgrf_industries.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 16a36dc6a..307cd2c0c 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -41,15 +41,6 @@ IndustryType MapNewGRFIndustryType(IndustryType grf_type, uint32 grf_id)
return _industry_mngr.GetID(GB(grf_type, 0, 6), grf_id);
}
-static uint32 GetGRFParameter(IndustryType ind_id, byte parameter)
-{
- const IndustrySpec *indspec = GetIndustrySpec(ind_id);
- const GRFFile *file = indspec->grf_prop.grffile;
-
- if (parameter >= file->param_end) return 0;
- return file->param[parameter];
-}
-
/**
* Finds the distance for the closest tile with water/land given a tile
* @param tile the tile to find the distance too
@@ -230,8 +221,6 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte par
if (industry == NULL) {
/* industry does not exist, only use those variables that are "safe" */
switch (variable) {
- /* Read GRF parameter */
- case 0x7F: return GetGRFParameter(type, parameter);
/* Manhattan distance of closes dry/water tile */
case 0x43: return GetClosestWaterDistance(tile, (indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) == 0);
}
@@ -318,9 +307,6 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte par
/* Get a variable from the persistent storage */
case 0x7C: return industry->psa.Get(parameter);
- /* Read GRF parameter */
- case 0x7F: return GetGRFParameter(type, parameter);
-
/* Industry structure access*/
case 0x80: return industry->xy;
case 0x81: return GB(industry->xy, 8, 8);
@@ -430,6 +416,9 @@ static void NewIndustryResolver(ResolverObject *res, TileIndex tile, Industry *i
res->trigger = 0;
res->reseed = 0;
res->count = 0;
+
+ const IndustrySpec *indspec = GetIndustrySpec(type);
+ res->grffile = (indspec != NULL ? indspec->grf_prop.grffile : NULL);
}
uint16 GetIndustryCallback(CallbackID callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile)