(svn r19199) -Codechange: add a 'name'-property to airport tiles

This commit is contained in:
yexo 2010-02-22 14:17:17 +00:00
parent 698737f485
commit 06dc421f2a
8 changed files with 39 additions and 9 deletions

View File

@ -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})

View File

@ -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);

View File

@ -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));

View File

@ -26,6 +26,7 @@
#include "variables.h"
#include "functions.h"
#include "core/random_func.hpp"
#include "table/strings.h"
#include "table/airporttiles.h"

View File

@ -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

View File

@ -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();

View File

@ -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}

View File

@ -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
};
/**