From d82f1b0babb10181a18f24fe705fa714bcc47379 Mon Sep 17 00:00:00 2001 From: yexo Date: Wed, 1 Sep 2010 23:14:15 +0000 Subject: [PATCH] (svn r20716) -Feature: add airport class and airport name to the land info tool --- src/lang/english.txt | 2 ++ src/misc_gui.cpp | 18 +++++++++++++++++- src/newgrf_airport.cpp | 2 +- src/station_cmd.cpp | 9 ++++++++- src/tile_cmd.h | 2 ++ 5 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index 06cb4eeb49..246c9574da 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2164,6 +2164,8 @@ STR_LAND_AREA_INFORMATION_LANDINFO_COORDS :{BLACK}Coordina STR_LAND_AREA_INFORMATION_BUILD_DATE :{BLACK}Built: {LTBLUE}{DATE_LONG} STR_LAND_AREA_INFORMATION_STATION_CLASS :{BLACK}Station class: {LTBLUE}{STRING} STR_LAND_AREA_INFORMATION_STATION_TYPE :{BLACK}Station type: {LTBLUE}{STRING} +STR_LAND_AREA_INFORMATION_AIRPORT_CLASS :{BLACK}Airport class: {LTBLUE}{STRING} +STR_LAND_AREA_INFORMATION_AIRPORT_NAME :{BLACK}Airport name: {LTBLUE}{STRING} STR_LAND_AREA_INFORMATION_AIRPORTTILE_NAME :{BLACK}Airport tile name: {LTBLUE}{STRING} STR_LAND_AREA_INFORMATION_NEWGRF_NAME :{BLACK}NewGRF: {LTBLUE}{RAW_STRING} STR_LAND_AREA_INFORMATION_CARGO_ACCEPTED :{BLACK}Cargo accepted: {LTBLUE} diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index bf9f79c101..50fa127fc3 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -149,6 +149,8 @@ public: td.station_class = STR_NULL; td.station_name = STR_NULL; + td.airport_class = STR_NULL; + td.airport_name = STR_NULL; td.airport_tile_name = STR_NULL; td.rail_speed = 0; @@ -237,7 +239,21 @@ public: line_nr++; } - /* Station type name */ + /* Airport class */ + if (td.airport_class != STR_NULL) { + SetDParam(0, td.airport_class); + GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_CLASS, lastof(this->landinfo_data[line_nr])); + line_nr++; + } + + /* Airport name */ + if (td.airport_name != STR_NULL) { + SetDParam(0, td.airport_name); + GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORT_NAME, lastof(this->landinfo_data[line_nr])); + line_nr++; + } + + /* Airport tile name */ if (td.airport_tile_name != STR_NULL) { SetDParam(0, td.airport_tile_name); GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_AIRPORTTILE_NAME, lastof(this->landinfo_data[line_nr])); diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp index 6a3b0b0ba3..d808936a23 100644 --- a/src/newgrf_airport.cpp +++ b/src/newgrf_airport.cpp @@ -207,7 +207,7 @@ static void NewAirportResolver(ResolverObject *res, TileIndex tile, Station *st, res->count = 0; const AirportSpec *as = AirportSpec::Get(airport_id); - res->grffile = (as != NULL ? as->grf_prop.grffile : NULL); + res->grffile = as->grf_prop.grffile; } SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index f6cba01bb4..12ea763d6f 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2805,10 +2805,17 @@ static void GetTileDesc_Station(TileIndex tile, TileDesc *td) } if (IsAirport(tile)) { + const AirportSpec *as = Station::GetByTile(tile)->airport.GetSpec(); + td->airport_class = AirportClass::GetName(as->cls_id); + td->airport_name = as->name; + const AirportTileSpec *ats = AirportTileSpec::GetByTile(tile); td->airport_tile_name = ats->name; - if (ats->grf_prop.grffile != NULL) { + if (as->grf_prop.grffile != NULL) { + const GRFConfig *gc = GetGRFConfig(as->grf_prop.grffile->grfid); + td->grf = gc->GetName(); + } else if (ats->grf_prop.grffile != NULL) { const GRFConfig *gc = GetGRFConfig(ats->grf_prop.grffile->grfid); td->grf = gc->GetName(); } diff --git a/src/tile_cmd.h b/src/tile_cmd.h index 6994d76527..ab4a8bc35e 100644 --- a/src/tile_cmd.h +++ b/src/tile_cmd.h @@ -57,6 +57,8 @@ struct TileDesc { Date build_date; ///< Date of construction of tile contents StringID station_class; ///< Class of station StringID station_name; ///< Type of station within the class + StringID airport_class; ///< Name of the airport class + StringID airport_name; ///< Name of the airport StringID airport_tile_name; ///< Name of the airport tile const char *grf; ///< newGRF used for the tile contents uint64 dparam[2]; ///< Parameters of the \a str string