diff --git a/src/depot_base.h b/src/depot_base.h index db375f893c..ededafae02 100644 --- a/src/depot_base.h +++ b/src/depot_base.h @@ -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) diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 2f65eccc70..02f92d8c31 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -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); diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index f35d751f72..ace31ad70a 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -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); diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 42731b0b25..9e9ba73022 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -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.