GRF: Use access mask when evaluating get nearby tile information variable

This commit is contained in:
Jonathan G Rennison
2022-05-31 01:32:18 +01:00
parent 7207c9330c
commit 8eb86fa6c7
10 changed files with 57 additions and 36 deletions

View File

@@ -31,12 +31,14 @@
* @param grf_version8 True, if we are dealing with a new NewGRF which uses GRF version >= 8.
* @return a construction of bits obeying the newgrf format
*/
uint32 GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, IndustryID index, bool signed_offsets, bool grf_version8)
uint32 GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, IndustryID index, bool signed_offsets, bool grf_version8, uint32 mask)
{
if (parameter != 0) tile = GetNearbyTile(parameter, tile, signed_offsets); // only perform if it is required
bool is_same_industry = (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == index);
return GetNearbyTileInformation(tile, grf_version8) | (is_same_industry ? 1 : 0) << 8;
uint32 result = (is_same_industry ? 1 : 0) << 8;
if (mask & ~0x100) result |= GetNearbyTileInformation(tile, grf_version8, mask);
return result;
}
/**
@@ -78,7 +80,7 @@ uint32 GetRelativePosition(TileIndex tile, TileIndex ind_tile)
/* Land info of nearby tiles */
case 0x60: return GetNearbyIndustryTileInformation(parameter, this->tile,
this->industry == nullptr ? (IndustryID)INVALID_INDUSTRY : this->industry->index, true, this->ro.grffile->grf_version >= 8);
this->industry == nullptr ? (IndustryID)INVALID_INDUSTRY : this->industry->index, true, this->ro.grffile->grf_version >= 8, extra->mask);
/* Animation stage of nearby tiles */
case 0x61: {