mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use member initialisation for TileDesc members.
parent
6e10584b91
commit
012daaa3d9
|
@ -139,38 +139,8 @@ public:
|
||||||
{
|
{
|
||||||
Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
|
Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
|
||||||
|
|
||||||
/* Because build_date is not set yet in every TileDesc, we make sure it is empty */
|
TileDesc td{};
|
||||||
TileDesc td;
|
|
||||||
|
|
||||||
td.build_date = CalendarTime::INVALID_DATE;
|
|
||||||
|
|
||||||
/* Most tiles have only one owner, but
|
|
||||||
* - drivethrough roadstops can be build on town owned roads (up to 2 owners) and
|
|
||||||
* - roads can have up to four owners (railroad, road, tram, 3rd-roadtype "highway").
|
|
||||||
*/
|
|
||||||
td.owner_type[0] = STR_LAND_AREA_INFORMATION_OWNER; // At least one owner is displayed, though it might be "N/A".
|
td.owner_type[0] = STR_LAND_AREA_INFORMATION_OWNER; // At least one owner is displayed, though it might be "N/A".
|
||||||
td.owner_type[1] = STR_NULL; // STR_NULL results in skipping the owner
|
|
||||||
td.owner_type[2] = STR_NULL;
|
|
||||||
td.owner_type[3] = STR_NULL;
|
|
||||||
td.owner[0] = OWNER_NONE;
|
|
||||||
td.owner[1] = OWNER_NONE;
|
|
||||||
td.owner[2] = OWNER_NONE;
|
|
||||||
td.owner[3] = OWNER_NONE;
|
|
||||||
|
|
||||||
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.railtype = STR_NULL;
|
|
||||||
td.rail_speed = 0;
|
|
||||||
td.roadtype = STR_NULL;
|
|
||||||
td.road_speed = 0;
|
|
||||||
td.tramtype = STR_NULL;
|
|
||||||
td.tram_speed = 0;
|
|
||||||
td.town_can_upgrade = std::nullopt;
|
|
||||||
|
|
||||||
td.grf = nullptr;
|
|
||||||
|
|
||||||
CargoArray acceptance{};
|
CargoArray acceptance{};
|
||||||
AddAcceptedCargo(tile, acceptance, nullptr);
|
AddAcceptedCargo(tile, acceptance, nullptr);
|
||||||
|
|
|
@ -50,24 +50,24 @@ struct TileInfo {
|
||||||
|
|
||||||
/** Tile description for the 'land area information' tool */
|
/** Tile description for the 'land area information' tool */
|
||||||
struct TileDesc {
|
struct TileDesc {
|
||||||
StringID str; ///< Description of the tile
|
StringID str{}; ///< Description of the tile
|
||||||
uint64_t dparam; ///< Parameter of the \a str string
|
uint64_t dparam = 0; ///< Parameter of the \a str string
|
||||||
Owner owner[4]; ///< Name of the owner(s)
|
std::array<Owner, 4> owner{}; ///< Name of the owner(s)
|
||||||
StringID owner_type[4]; ///< Type of each owner
|
std::array<StringID, 4> owner_type{}; ///< Type of each owner
|
||||||
TimerGameCalendar::Date build_date; ///< Date of construction of tile contents
|
TimerGameCalendar::Date build_date = CalendarTime::INVALID_DATE; ///< Date of construction of tile contents
|
||||||
StringID station_class; ///< Class of station
|
StringID station_class{}; ///< Class of station
|
||||||
StringID station_name; ///< Type of station within the class
|
StringID station_name{}; ///< Type of station within the class
|
||||||
StringID airport_class; ///< Name of the airport class
|
StringID airport_class{}; ///< Name of the airport class
|
||||||
StringID airport_name; ///< Name of the airport
|
StringID airport_name{}; ///< Name of the airport
|
||||||
StringID airport_tile_name; ///< Name of the airport tile
|
StringID airport_tile_name{}; ///< Name of the airport tile
|
||||||
const char *grf; ///< newGRF used for the tile contents
|
const char *grf = nullptr; ///< newGRF used for the tile contents
|
||||||
StringID railtype; ///< Type of rail on the tile.
|
StringID railtype{}; ///< Type of rail on the tile.
|
||||||
uint16_t rail_speed; ///< Speed limit of rail (bridges and track)
|
uint16_t rail_speed = 0; ///< Speed limit of rail (bridges and track)
|
||||||
StringID roadtype; ///< Type of road on the tile.
|
StringID roadtype{}; ///< Type of road on the tile.
|
||||||
uint16_t road_speed; ///< Speed limit of road (bridges and track)
|
uint16_t road_speed = 0; ///< Speed limit of road (bridges and track)
|
||||||
StringID tramtype; ///< Type of tram on the tile.
|
StringID tramtype{}; ///< Type of tram on the tile.
|
||||||
uint16_t tram_speed; ///< Speed limit of tram (bridges and track)
|
uint16_t tram_speed = 0; ///< Speed limit of tram (bridges and track)
|
||||||
std::optional<bool> town_can_upgrade; ///< Whether the town can upgrade this house during town growth.
|
std::optional<bool> town_can_upgrade = std::nullopt; ///< Whether the town can upgrade this house during town growth.
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue