diff options
author | frosch <frosch@openttd.org> | 2011-10-21 19:10:35 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-10-21 19:10:35 +0000 |
commit | 3eddb9c23fcc4aac9fc32bd6e923eada4bdcd9e5 (patch) | |
tree | aa9b65f4e4035f8bea81c287d2f109143598692b /src/industry_cmd.cpp | |
parent | 3e5a75839015c86400736b6047859e1023b37b96 (diff) | |
download | openttd-3eddb9c23fcc4aac9fc32bd6e923eada4bdcd9e5.tar.xz |
(svn r23049) -Fix [FS#4810]: Use the same forest-check for the vegetation-map colour as for nearby station names.
Diffstat (limited to 'src/industry_cmd.cpp')
-rw-r--r-- | src/industry_cmd.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index ed9d2bfbc..f60b6f1cd 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -911,6 +911,30 @@ static void ChangeTileOwner_Industry(TileIndex tile, Owner old_owner, Owner new_ if (i->founder == old_owner) i->founder = (new_owner == INVALID_OWNER) ? OWNER_NONE : new_owner; } +/** + * Check whether the tile is a forest. + * @param tile the tile to investigate. + * @return true if and only if the tile is a forest + */ +bool IsTileForestIndustry(TileIndex tile) +{ + /* Check for industry tile */ + if (!IsTileType(tile, MP_INDUSTRY)) return false; + + const Industry *ind = Industry::GetByTile(tile); + + /* Check for organic industry (i.e. not processing or extractive) */ + if ((GetIndustrySpec(ind->type)->life_type & INDUSTRYLIFE_ORGANIC) == 0) return false; + + /* Check for wood production */ + for (uint i = 0; i < lengthof(ind->produced_cargo); i++) { + /* The industry produces wood. */ + if (ind->produced_cargo[i] != CT_INVALID && CargoSpec::Get(ind->produced_cargo[i])->label == 'WOOD') return true; + } + + return false; +} + static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6}; static bool IsBadFarmFieldTile(TileIndex tile) |