1
0
Fork 0

(svn r20625) -Add: AirportTileSpec::GetByTile to simplify accessing the AirportTileSpec

release/1.1
rubidium 2010-08-26 16:53:06 +00:00
parent 9982b5fd00
commit 82ef98a90a
3 changed files with 12 additions and 1 deletions

View File

@ -47,6 +47,16 @@ AirportTileOverrideManager _airporttile_mngr(NEW_AIRPORTTILE_OFFSET, NUM_AIRPORT
return &AirportTileSpec::tiles[gfx]; return &AirportTileSpec::tiles[gfx];
} }
/**
* Retrieve airport tile spec for the given airport tile.
* @param tile The airport tile.
* @return A pointer to the corresponding AirportTileSpec.
*/
/* static */ const AirportTileSpec *AirportTileSpec::GetByTile(TileIndex tile)
{
return AirportTileSpec::Get(GetAirportGfx(tile));
}
/** /**
* This function initializes the tile array of AirportTileSpec * This function initializes the tile array of AirportTileSpec
*/ */

View File

@ -29,6 +29,7 @@ struct AirportTileSpec {
GRFFileProps grf_prop; ///< properties related the the grf file GRFFileProps grf_prop; ///< properties related the the grf file
static const AirportTileSpec *Get(StationGfx gfx); static const AirportTileSpec *Get(StationGfx gfx);
static const AirportTileSpec *GetByTile(TileIndex tile);
static void ResetAirportTiles(); static void ResetAirportTiles();

View File

@ -2807,7 +2807,7 @@ static void GetTileDesc_Station(TileIndex tile, TileDesc *td)
} }
if (IsAirport(tile)) { if (IsAirport(tile)) {
const AirportTileSpec *ats = AirportTileSpec::Get(GetAirportGfx(tile)); const AirportTileSpec *ats = AirportTileSpec::GetByTile(tile);
td->airport_tile_name = ats->name; td->airport_tile_name = ats->name;
if (ats->grf_prop.grffile != NULL) { if (ats->grf_prop.grffile != NULL) {