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

@@ -106,12 +106,14 @@ StationGfx GetTranslatedAirportTileID(StationGfx gfx)
* @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
*/
static uint32 GetNearbyAirportTileInformation(byte parameter, TileIndex tile, StationID index, bool grf_version8)
static uint32 GetNearbyAirportTileInformation(byte parameter, TileIndex tile, StationID index, bool grf_version8, uint32 mask)
{
if (parameter != 0) tile = GetNearbyTile(parameter, tile); // only perform if it is required
bool is_same_airport = (IsTileType(tile, MP_STATION) && IsAirport(tile) && GetStationIndex(tile) == index);
return GetNearbyTileInformation(tile, grf_version8) | (is_same_airport ? 1 : 0) << 8;
uint32 result = (is_same_airport ? 1 : 0) << 8;
if (mask & ~0x100) result |= GetNearbyTileInformation(tile, grf_version8, mask);
return result;
}
@@ -178,7 +180,7 @@ static uint32 GetAirportTileIDAtOffset(TileIndex tile, const Station *st, uint32
case 0x44: return GetAnimationFrame(this->tile);
/* Land info of nearby tiles */
case 0x60: return GetNearbyAirportTileInformation(parameter, this->tile, this->st->index, this->ro.grffile->grf_version >= 8);
case 0x60: return GetNearbyAirportTileInformation(parameter, this->tile, this->st->index, this->ro.grffile->grf_version >= 8, extra->mask);
/* Animation stage of nearby tiles */
case 0x61: {