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