summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-02-22 14:17:17 +0000
committeryexo <yexo@openttd.org>2010-02-22 14:17:17 +0000
commit06dc421f2ab025aa248a372d48c5701d7a9e2ff9 (patch)
tree7542a38804ee09694b5ea606a7a74a861c1375b5 /src
parent698737f485cfbdd1605faecd50395bb67f7dac75 (diff)
downloadopenttd-06dc421f2ab025aa248a372d48c5701d7a9e2ff9.tar.xz
(svn r19199) -Codechange: add a 'name'-property to airport tiles
Diffstat (limited to 'src')
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/misc_gui.cpp8
-rw-r--r--src/newgrf.cpp8
-rw-r--r--src/newgrf_airporttiles.cpp1
-rw-r--r--src/newgrf_airporttiles.h1
-rw-r--r--src/station_cmd.cpp10
-rw-r--r--src/table/airporttiles.h2
-rw-r--r--src/tile_cmd.h17
8 files changed, 39 insertions, 9 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 12f64aac5..a146f851c 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -2121,6 +2121,7 @@ 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_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}
STR_LAND_AREA_INFORMATION_CARGO_EIGHTS :({COMMA}/8 {STRING})
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index f33556a85..c456394f6 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -157,6 +157,7 @@ public:
td.station_class = STR_NULL;
td.station_name = STR_NULL;
+ td.airport_tile_name = STR_NULL;
td.grf = NULL;
@@ -243,6 +244,13 @@ public:
line_nr++;
}
+ /* Station type 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]));
+ line_nr++;
+ }
+
/* NewGRF name */
if (td.grf != NULL) {
SetDParamStr(0, td.grf);
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index f856310ae..786d33959 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -3845,6 +3845,14 @@ static void FeatureNewName(ByteReader *buf)
}
break;
+ case 0xC7: // Airporttile name
+ if (_cur_grffile->airtspec == NULL || _cur_grffile->airtspec[GB(id, 0, 8)] == NULL) {
+ grfmsg(1, "FeatureNewName: Attempt to name undefined airport tile 0x%X, ignoring", GB(id, 0, 8));
+ } else {
+ _cur_grffile->airtspec[GB(id, 0, 8)]->name = AddGRFString(_cur_grffile->grfid, id, lang, new_scheme, name, STR_UNDEFINED);
+ }
+ break;
+
case 0xC9: // House name
if (_cur_grffile->housespec == NULL || _cur_grffile->housespec[GB(id, 0, 8)] == NULL) {
grfmsg(1, "FeatureNewName: Attempt to name undefined house 0x%X, ignoring.", GB(id, 0, 8));
diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp
index 05e7951a4..1b2d78216 100644
--- a/src/newgrf_airporttiles.cpp
+++ b/src/newgrf_airporttiles.cpp
@@ -26,6 +26,7 @@
#include "variables.h"
#include "functions.h"
#include "core/random_func.hpp"
+#include "table/strings.h"
#include "table/airporttiles.h"
diff --git a/src/newgrf_airporttiles.h b/src/newgrf_airporttiles.h
index f295530de..2c18d2fcf 100644
--- a/src/newgrf_airporttiles.h
+++ b/src/newgrf_airporttiles.h
@@ -33,6 +33,7 @@ struct AirportTileSpec {
uint16 animation_info; ///< Information about the animation (is it looping, how many loops etc)
uint8 animation_speed; ///< The speed of the animation
+ StringID name; ///< Tile Subname string, land information on this tile will give you "AirportName (TileSubname)"
uint8 callback_flags; ///< Flags telling which grf callback is set
uint8 animation_triggers; ///< When to start the animation
uint8 animation_special_flags; ///< Extra flags to influence the animation
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index d3e033ccf..ad0eaa4a6 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2643,6 +2643,16 @@ static void GetTileDesc_Station(TileIndex tile, TileDesc *td)
}
}
+ if (IsAirport(tile)) {
+ const AirportTileSpec *ats = AirportTileSpec::Get(GetAirportGfx(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->name;
+ }
+ }
+
StringID str;
switch (GetStationType(tile)) {
default: NOT_REACHED();
diff --git a/src/table/airporttiles.h b/src/table/airporttiles.h
index 2f3a889fe..3d1894743 100644
--- a/src/table/airporttiles.h
+++ b/src/table/airporttiles.h
@@ -13,7 +13,7 @@
#define AIRPORTTILES_H
/** Writes all airport tile properties in the AirportTile struct */
-#define AT(num_frames, anim_speed) {(1 << 8) | num_frames, anim_speed, 0, 0, 0, true, {INVALID_AIRPORTTILE, 0, NULL, NULL, INVALID_AIRPORTTILE}}
+#define AT(num_frames, anim_speed) {(1 << 8) | num_frames, anim_speed, STR_NULL, 0, 0, 0, true, {INVALID_AIRPORTTILE, 0, NULL, NULL, INVALID_AIRPORTTILE}}
/** Writes an airport tile without animation in the AirportTile struct */
#define AT_NOANIM {0xFFFF, 2}
diff --git a/src/tile_cmd.h b/src/tile_cmd.h
index d8eede25d..630da4e0f 100644
--- a/src/tile_cmd.h
+++ b/src/tile_cmd.h
@@ -51,14 +51,15 @@ struct TileInfo {
/** Tile description for the 'land area information' tool */
struct TileDesc {
- StringID str; ///< Description of the tile
- Owner owner[4]; ///< Name of the owner(s)
- StringID owner_type[4]; ///< Type of each owner
- Date build_date; ///< Date of construction of tile contents
- StringID station_class; ///< Class of station
- StringID station_name; ///< Type of station within the class
- const char *grf; ///< newGRF used for the tile contents
- uint64 dparam[2]; ///< Parameters of the \a str string
+ StringID str; ///< Description of the tile
+ Owner owner[4]; ///< Name of the owner(s)
+ StringID owner_type[4]; ///< Type of each owner
+ 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_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
};
/**