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 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);
|
||||
|
||||
/* 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:
|
||||
friend SaveLoadTable GetOrderBackupDescription(); ///< Saving and loading of order backups.
|
||||
friend struct BKORChunkHandler; ///< Creating empty orders upon savegame loading.
|
||||
uint32_t user; ///< The user that requested the backup.
|
||||
TileIndex tile; ///< Tile of the depot where the order was changed.
|
||||
GroupID group; ///< The group the vehicle was part of.
|
||||
uint32_t user = 0; ///< The user that requested the backup.
|
||||
TileIndex tile = INVALID_TILE; ///< Tile of the depot where the order was changed.
|
||||
GroupID group = GroupID::Invalid(); ///< The group the vehicle was part of.
|
||||
|
||||
const Vehicle *clone; ///< Vehicle this vehicle was a clone of.
|
||||
Order *orders; ///< The actual orders if the vehicle was not a clone.
|
||||
const Vehicle *clone = nullptr; ///< Vehicle this vehicle was a clone of.
|
||||
Order *orders = nullptr; ///< The actual orders if the vehicle was not a clone.
|
||||
|
||||
/** Creation for savegame restoration. */
|
||||
OrderBackup() {}
|
||||
|
|
|
@ -260,20 +260,18 @@ private:
|
|||
friend void AfterLoadVehiclesPhase1(bool part_of_load); ///< For instantiating the shared vehicle chain
|
||||
friend SaveLoadTable GetOrderListDescription(); ///< Saving and loading of order lists.
|
||||
|
||||
VehicleOrderID num_orders; ///< NOSAVE: How many orders there are in the list.
|
||||
VehicleOrderID num_manual_orders; ///< NOSAVE: How many manually added orders are there in the list.
|
||||
uint num_vehicles; ///< NOSAVE: Number of vehicles that share this order list.
|
||||
Vehicle *first_shared; ///< NOSAVE: pointer to the first vehicle in the shared order chain.
|
||||
Order *first; ///< First order of the order list.
|
||||
VehicleOrderID num_orders = INVALID_VEH_ORDER_ID; ///< NOSAVE: How many orders there are in the list.
|
||||
VehicleOrderID num_manual_orders = 0; ///< NOSAVE: How many manually added orders are there in the list.
|
||||
uint num_vehicles = 0; ///< NOSAVE: Number of vehicles that share this order list.
|
||||
Vehicle *first_shared = nullptr; ///< NOSAVE: pointer to the first vehicle in the shared order chain.
|
||||
Order *first = nullptr; ///< First order 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 timetable_duration{}; ///< NOSAVE: Total timetabled duration of the order list.
|
||||
TimerGameTick::Ticks total_duration{}; ///< NOSAVE: Total (timetabled or not) duration of the order list.
|
||||
|
||||
public:
|
||||
/** Default constructor producing an invalid order list. */
|
||||
OrderList(VehicleOrderID num_orders = INVALID_VEH_ORDER_ID)
|
||||
: num_orders(num_orders), num_manual_orders(0), num_vehicles(0), first_shared(nullptr), first(nullptr),
|
||||
timetable_duration(0), total_duration(0) { }
|
||||
OrderList(VehicleOrderID num_orders = INVALID_VEH_ORDER_ID) : num_orders(num_orders) { }
|
||||
|
||||
/**
|
||||
* Create an order list with the given order chain for the given vehicle.
|
||||
|
|
Loading…
Reference in New Issue