summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-09-01 23:14:15 +0000
committeryexo <yexo@openttd.org>2010-09-01 23:14:15 +0000
commitc07fdab16c4a89dda13efa72fdb5c081872de1ce (patch)
tree04c6eae1387ef0eed4c27d4a5d264ec6c5c85a1a
parente640373475375d2bd2f5f4215b0d58b7002175f7 (diff)
downloadopenttd-c07fdab16c4a89dda13efa72fdb5c081872de1ce.tar.xz
(svn r20716) -Feature: add airport class and airport name to the land info tool
-rw-r--r--src/lang/english.txt2
-rw-r--r--src/misc_gui.cpp18
-rw-r--r--src/newgrf_airport.cpp2
-rw-r--r--src/station_cmd.cpp9
-rw-r--r--src/tile_cmd.h2
5 files changed, 30 insertions, 3 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 06cb4eeb4..246c9574d 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 bf9f79c10..50fa127fc 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 6a3b0b0ba..d808936a2 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 f6cba01bb..12ea763d6 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 6994d7652..ab4a8bc35 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