From 6aae285b72bfe5612ccfc59f75fe51ee557086cd Mon Sep 17 00:00:00 2001 From: yexo Date: Fri, 9 Dec 2011 16:11:42 +0000 Subject: (svn r23457) -Codechange: introduce Industry::TileBelongsToIndustry() to simplify code checking for that --- src/industry.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/industry.h') diff --git a/src/industry.h b/src/industry.h index b31bbd01e..85d86a110 100644 --- a/src/industry.h +++ b/src/industry.h @@ -77,6 +77,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 -- cgit v1.2.3-54-g00ecf