mirror of https://github.com/OpenTTD/OpenTTD
Codechange: explicitly initialise Depot member variables
parent
1f3198a395
commit
0449dc48c8
|
@ -19,13 +19,14 @@ extern DepotPool _depot_pool;
|
|||
|
||||
struct Depot : DepotPool::PoolItem<&_depot_pool> {
|
||||
/* DepotID index member of DepotPool is 2 bytes. */
|
||||
uint16_t town_cn; ///< The N-1th depot for this town (consecutive number)
|
||||
TileIndex xy;
|
||||
Town *town;
|
||||
std::string name;
|
||||
TimerGameCalendar::Date build_date; ///< Date of construction
|
||||
uint16_t town_cn = 0; ///< The N-1th depot for this town (consecutive number)
|
||||
TileIndex xy = INVALID_TILE;
|
||||
Town *town = nullptr;
|
||||
std::string name{};
|
||||
TimerGameCalendar::Date build_date{}; ///< Date of construction
|
||||
|
||||
Depot(TileIndex xy = INVALID_TILE) : xy(xy) {}
|
||||
Depot() {}
|
||||
Depot(TileIndex xy) : xy(xy), build_date(TimerGameCalendar::date) {}
|
||||
~Depot();
|
||||
|
||||
static inline Depot *GetByTile(TileIndex tile)
|
||||
|
|
|
@ -1011,7 +1011,6 @@ CommandCost CmdBuildTrainDepot(DoCommandFlags flags, TileIndex tile, RailType ra
|
|||
SetRailDepotExitDirection(tile, dir);
|
||||
} else {
|
||||
Depot *d = new Depot(tile);
|
||||
d->build_date = TimerGameCalendar::date;
|
||||
|
||||
MakeRailDepot(tile, _current_company, d->index, dir, railtype);
|
||||
MakeDefaultName(d);
|
||||
|
|
|
@ -1188,7 +1188,6 @@ CommandCost CmdBuildRoadDepot(DoCommandFlags flags, TileIndex tile, RoadType rt,
|
|||
SetRoadDepotExitDirection(tile, dir);
|
||||
} else {
|
||||
Depot *dep = new Depot(tile);
|
||||
dep->build_date = TimerGameCalendar::date;
|
||||
MakeRoadDepot(tile, _current_company, dep->index, dir, rt);
|
||||
MakeDefaultName(dep);
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ CommandCost CmdBuildShipDepot(DoCommandFlags flags, TileIndex tile, Axis axis)
|
|||
|
||||
if (flags.Test(DoCommandFlag::Execute)) {
|
||||
Depot *depot = new Depot(tile);
|
||||
depot->build_date = TimerGameCalendar::date;
|
||||
|
||||
uint new_water_infra = 2 * LOCK_DEPOT_TILE_FACTOR;
|
||||
/* Update infrastructure counts after the tile clears earlier.
|
||||
|
|
Loading…
Reference in New Issue