summaryrefslogtreecommitdiff
path: root/src/industry.h
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2011-12-09 16:11:42 +0000
committeryexo <yexo@openttd.org>2011-12-09 16:11:42 +0000
commit6aae285b72bfe5612ccfc59f75fe51ee557086cd (patch)
tree14d4e9ea34f472412b0a0df2e81fd1ea1dd5015d /src/industry.h
parente7777f44b9c6e44b882052227f371def959ffbfd (diff)
downloadopenttd-6aae285b72bfe5612ccfc59f75fe51ee557086cd.tar.xz
(svn r23457) -Codechange: introduce Industry::TileBelongsToIndustry() to simplify code checking for that
Diffstat (limited to 'src/industry.h')
-rw-r--r--src/industry.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/industry.h b/src/industry.h
index b31bbd01e..85d86a110 100644
--- a/src/industry.h
+++ b/src/industry.h
@@ -78,6 +78,16 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> {
void RecomputeProductionMultipliers();
/**
+ * Check if a given tile belongs to this industry.
+ * @param tile The tile to check.
+ * @return True if the tils is part of this industry.
+ */
+ inline bool TileBelongsToIndustry(TileIndex tile) const
+ {
+ return IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == this->index;
+ }
+
+ /**
* Get the industry of the given tile
* @param tile the tile to get the industry from
* @pre IsTileType(t, MP_INDUSTRY)