Changeset - r15927:e47dbd2576e2
[Not reviewed]
master
0 3 0
rubidium - 14 years ago 2010-08-26 16:53:06
rubidium@openttd.org
(svn r20625) -Add: AirportTileSpec::GetByTile to simplify accessing the AirportTileSpec
3 files changed with 12 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/newgrf_airporttiles.cpp
Show inline comments
 
@@ -45,12 +45,22 @@ AirportTileOverrideManager _airporttile_
 
	 * since it's always true if the following holds: */
 
	assert_compile(MAX_UVALUE(StationGfx) + 1 == lengthof(tiles));
 
	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
 
 */
 
void AirportTileSpec::ResetAirportTiles()
 
{
 
	memset(&AirportTileSpec::tiles, 0, sizeof(AirportTileSpec::tiles));
 
	memcpy(&AirportTileSpec::tiles, &_origin_airporttile_specs, sizeof(_origin_airporttile_specs));
src/newgrf_airporttiles.h
Show inline comments
 
@@ -26,12 +26,13 @@ struct AirportTileSpec {
 
	uint8 callback_mask;                  ///< Bitmask telling which grf callback is set
 
	uint8 animation_special_flags;        ///< Extra flags to influence the animation
 
	bool enabled;                         ///< entity still available (by default true). newgrf can disable it, though
 
	GRFFileProps grf_prop;                ///< properties related the the grf file
 

	
 
	static const AirportTileSpec *Get(StationGfx gfx);
 
	static const AirportTileSpec *GetByTile(TileIndex tile);
 

	
 
	static void ResetAirportTiles();
 

	
 
private:
 
	static AirportTileSpec tiles[NUM_AIRPORTTILES];
 

	
src/station_cmd.cpp
Show inline comments
 
@@ -2804,13 +2804,13 @@ static void GetTileDesc_Station(TileInde
 

	
 
		const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
 
		td->rail_speed = rti->max_speed;
 
	}
 

	
 
	if (IsAirport(tile)) {
 
		const AirportTileSpec *ats = AirportTileSpec::Get(GetAirportGfx(tile));
 
		const AirportTileSpec *ats = AirportTileSpec::GetByTile(tile);
 
		td->airport_tile_name = ats->name;
 

	
 
		if (ats->grf_prop.grffile != NULL) {
 
			const GRFConfig *gc = GetGRFConfig(ats->grf_prop.grffile->grfid);
 
			td->grf = gc->GetName();
 
		}
0 comments (0 inline, 0 general)