mirror of https://github.com/OpenTTD/OpenTTD
Codechange: explicitly initialise OrderBackup and OrderList member variables
parent
0a285e1a86
commit
5ccbaa6990
|
@ -43,12 +43,8 @@ OrderBackup::~OrderBackup()
|
||||||
* @param v The vehicle to make a backup of.
|
* @param v The vehicle to make a backup of.
|
||||||
* @param user The user that is requesting the backup.
|
* @param user The user that is requesting the backup.
|
||||||
*/
|
*/
|
||||||
OrderBackup::OrderBackup(const Vehicle *v, uint32_t user)
|
OrderBackup::OrderBackup(const Vehicle *v, uint32_t user) : user(user), tile(v->tile), group(v->group_id)
|
||||||
{
|
{
|
||||||
this->user = user;
|
|
||||||
this->tile = v->tile;
|
|
||||||
this->group = v->group_id;
|
|
||||||
|
|
||||||
this->CopyConsistPropertiesFrom(v);
|
this->CopyConsistPropertiesFrom(v);
|
||||||
|
|
||||||
/* If we have shared orders, store the vehicle we share the order with. */
|
/* If we have shared orders, store the vehicle we share the order with. */
|
||||||
|
|
|
@ -34,12 +34,12 @@ struct OrderBackup : OrderBackupPool::PoolItem<&_order_backup_pool>, BaseConsist
|
||||||
private:
|
private:
|
||||||
friend SaveLoadTable GetOrderBackupDescription(); ///< Saving and loading of order backups.
|
friend SaveLoadTable GetOrderBackupDescription(); ///< Saving and loading of order backups.
|
||||||
friend struct BKORChunkHandler; ///< Creating empty orders upon savegame loading.
|
friend struct BKORChunkHandler; ///< Creating empty orders upon savegame loading.
|
||||||
uint32_t user; ///< The user that requested the backup.
|
uint32_t user = 0; ///< The user that requested the backup.
|
||||||
TileIndex tile; ///< Tile of the depot where the order was changed.
|
TileIndex tile = INVALID_TILE; ///< Tile of the depot where the order was changed.
|
||||||
GroupID group; ///< The group the vehicle was part of.
|
GroupID group = GroupID::Invalid(); ///< The group the vehicle was part of.
|
||||||
|
|
||||||
const Vehicle *clone; ///< Vehicle this vehicle was a clone of.
|
const Vehicle *clone = nullptr; ///< Vehicle this vehicle was a clone of.
|
||||||
Order *orders; ///< The actual orders if the vehicle was not a clone.
|
Order *orders = nullptr; ///< The actual orders if the vehicle was not a clone.
|
||||||
|
|
||||||
/** Creation for savegame restoration. */
|
/** Creation for savegame restoration. */
|
||||||
OrderBackup() {}
|
OrderBackup() {}
|
||||||
|
|
|
@ -260,20 +260,18 @@ private:
|
||||||
friend void AfterLoadVehiclesPhase1(bool part_of_load); ///< For instantiating the shared vehicle chain
|
friend void AfterLoadVehiclesPhase1(bool part_of_load); ///< For instantiating the shared vehicle chain
|
||||||
friend SaveLoadTable GetOrderListDescription(); ///< Saving and loading of order lists.
|
friend SaveLoadTable GetOrderListDescription(); ///< Saving and loading of order lists.
|
||||||
|
|
||||||
VehicleOrderID num_orders; ///< NOSAVE: How many orders there are in the list.
|
VehicleOrderID num_orders = INVALID_VEH_ORDER_ID; ///< NOSAVE: How many orders there are in the list.
|
||||||
VehicleOrderID num_manual_orders; ///< NOSAVE: How many manually added orders are there in the list.
|
VehicleOrderID num_manual_orders = 0; ///< NOSAVE: How many manually added orders are there in the list.
|
||||||
uint num_vehicles; ///< NOSAVE: Number of vehicles that share this order list.
|
uint num_vehicles = 0; ///< NOSAVE: Number of vehicles that share this order list.
|
||||||
Vehicle *first_shared; ///< NOSAVE: pointer to the first vehicle in the shared order chain.
|
Vehicle *first_shared = nullptr; ///< NOSAVE: pointer to the first vehicle in the shared order chain.
|
||||||
Order *first; ///< First order of the order list.
|
Order *first = nullptr; ///< First order of the order list.
|
||||||
|
|
||||||
TimerGameTick::Ticks timetable_duration; ///< NOSAVE: Total timetabled duration of the order list.
|
TimerGameTick::Ticks timetable_duration{}; ///< NOSAVE: Total timetabled duration of the order list.
|
||||||
TimerGameTick::Ticks total_duration; ///< NOSAVE: Total (timetabled or not) duration of the order list.
|
TimerGameTick::Ticks total_duration{}; ///< NOSAVE: Total (timetabled or not) duration of the order list.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default constructor producing an invalid order list. */
|
/** Default constructor producing an invalid order list. */
|
||||||
OrderList(VehicleOrderID num_orders = INVALID_VEH_ORDER_ID)
|
OrderList(VehicleOrderID num_orders = INVALID_VEH_ORDER_ID) : num_orders(num_orders) { }
|
||||||
: num_orders(num_orders), num_manual_orders(0), num_vehicles(0), first_shared(nullptr), first(nullptr),
|
|
||||||
timetable_duration(0), total_duration(0) { }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an order list with the given order chain for the given vehicle.
|
* Create an order list with the given order chain for the given vehicle.
|
||||||
|
|
Loading…
Reference in New Issue