summaryrefslogtreecommitdiff
path: root/src/industry.h
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-08-24 00:23:35 +0000
committerbelugas <belugas@openttd.org>2007-08-24 00:23:35 +0000
commit40d4d2f2cabc3ba9a15294422f944690de0d5984 (patch)
tree4cbae99b4d2ec0b1c709d85ea814a81a94cbef54 /src/industry.h
parente9435c11b08664818f03aa747df373e7f8ff9cc4 (diff)
downloadopenttd-40d4d2f2cabc3ba9a15294422f944690de0d5984.tar.xz
(svn r10972) -Codechange: Implement the counterpart(GetTranslatedIndustryTileID) of getindustileid of TTDPatch. This allows to ensure that the ID of a tile (taken out of the map or not) is still a valid one regarding the possible override it may have been flagged to.
It is not the strict same thing, but is what we need regarding the slightly different approach we took for newindustries.
Diffstat (limited to 'src/industry.h')
-rw-r--r--src/industry.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/industry.h b/src/industry.h
index c92c12041..2cdf1ce7e 100644
--- a/src/industry.h
+++ b/src/industry.h
@@ -220,6 +220,13 @@ void PlantRandomFarmField(const Industry *i);
extern IndustrySpec _industry_specs[NUM_INDUSTRYTYPES];
extern IndustryTileSpec _industry_tile_specs[NUM_INDUSTRYTILES];
+static inline IndustryGfx GetTranslatedIndustryTileID(IndustryGfx gfx)
+{
+ assert(gfx < INVALID_INDUSTRYTILE);
+ const IndustryTileSpec *it = &_industry_tile_specs[gfx];
+ return it->grf_prop.override == INVALID_INDUSTRYTILE ? gfx : it->grf_prop.override;
+}
+
/* smallmap_gui.cpp */
void BuildIndustriesLegend();