# HG changeset patch # User yexo # Date 2010-02-22 14:17:17 # Node ID 34835c8eb3964edd8ac9ed4a2963128778dc9f18 # Parent 79a9ea376bde204a7c9d6cdeac866667c1ebc66d (svn r19199) -Codechange: add a 'name'-property to airport tiles diff --git a/src/lang/english.txt b/src/lang/english.txt --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2121,6 +2121,7 @@ STR_LAND_AREA_INFORMATION_LANDINFO_COORD 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 --- 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 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -3845,6 +3845,14 @@ static void FeatureNewName(ByteReader *b } 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 --- 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 --- 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 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2643,6 +2643,16 @@ static void GetTileDesc_Station(TileInde } } + 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 --- 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 --- 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 }; /**