(svn r23457) -Codechange: introduce Industry::TileBelongsToIndustry() to simplify code checking for that

This commit is contained in:
yexo
2011-12-09 16:11:42 +00:00
parent e7777f44b9
commit 6aae285b72
4 changed files with 15 additions and 5 deletions

View File

@@ -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