(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

@@ -248,7 +248,7 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, uint32 p
/* Get random tile bits at offset param */
case 0x61:
tile = GetNearbyTile(parameter, tile, false);
return (IsTileType(tile, MP_INDUSTRY) && Industry::GetByTile(tile) == industry) ? GetIndustryRandomBits(tile) : 0;
return industry->TileBelongsToIndustry(tile) ? GetIndustryRandomBits(tile) : 0;
/* Land info of nearby tiles */
case 0x62: return GetNearbyIndustryTileInformation(parameter, tile, INVALID_INDUSTRY, false, object->grffile->grf_version >= 8);
@@ -256,7 +256,7 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, uint32 p
/* Animation stage of nearby tiles */
case 0x63:
tile = GetNearbyTile(parameter, tile, false);
if (IsTileType(tile, MP_INDUSTRY) && Industry::GetByTile(tile) == industry) {
if (industry->TileBelongsToIndustry(tile)) {
return GetAnimationFrame(tile);
}
return 0xFFFFFFFF;