|
|
@ -29,7 +29,7 @@ typedef Pool<CargoPacket, CargoPacketID, 1024, 1048576> CargoPacketPool;
|
|
|
|
/** The actual pool with cargo packets */
|
|
|
|
/** The actual pool with cargo packets */
|
|
|
|
extern CargoPacketPool _cargopacket_pool;
|
|
|
|
extern CargoPacketPool _cargopacket_pool;
|
|
|
|
|
|
|
|
|
|
|
|
class CargoList;
|
|
|
|
template <class Tinst> class CargoList;
|
|
|
|
extern const struct SaveLoad *GetCargoPacketDesc();
|
|
|
|
extern const struct SaveLoad *GetCargoPacketDesc();
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -44,7 +44,7 @@ private:
|
|
|
|
byte days_in_transit; ///< Amount of days this packet has been in transit
|
|
|
|
byte days_in_transit; ///< Amount of days this packet has been in transit
|
|
|
|
|
|
|
|
|
|
|
|
/** The CargoList caches, thus needs to know about it. */
|
|
|
|
/** The CargoList caches, thus needs to know about it. */
|
|
|
|
friend class CargoList;
|
|
|
|
template <class Tinst> friend class CargoList;
|
|
|
|
friend class VehicleCargoList;
|
|
|
|
friend class VehicleCargoList;
|
|
|
|
friend class StationCargoList;
|
|
|
|
friend class StationCargoList;
|
|
|
|
/** We want this to be saved, right? */
|
|
|
|
/** We want this to be saved, right? */
|
|
|
@ -147,7 +147,9 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Simple collection class for a list of cargo packets
|
|
|
|
* Simple collection class for a list of cargo packets
|
|
|
|
|
|
|
|
* @tparam Tinst The actual instantation of this cargo list
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
template <class Tinst>
|
|
|
|
class CargoList {
|
|
|
|
class CargoList {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
/** List of cargo packets */
|
|
|
|
/** List of cargo packets */
|
|
|
@ -192,16 +194,11 @@ public:
|
|
|
|
* Returns a pointer to the cargo packet list (so you can iterate over it etc).
|
|
|
|
* Returns a pointer to the cargo packet list (so you can iterate over it etc).
|
|
|
|
* @return pointer to the packet list
|
|
|
|
* @return pointer to the packet list
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
FORCEINLINE const CargoList::List *Packets() const
|
|
|
|
FORCEINLINE const List *Packets() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return &this->packets;
|
|
|
|
return &this->packets;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Ages the all cargo in this list
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void AgeCargo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Checks whether this list is empty
|
|
|
|
* Checks whether this list is empty
|
|
|
|
* @return true if and only if the list is empty
|
|
|
|
* @return true if and only if the list is empty
|
|
|
@ -285,7 +282,8 @@ public:
|
|
|
|
* @pre mta == MTA_UNLOAD || mta == MTA_CARGO_LOAD || payment != NULL
|
|
|
|
* @pre mta == MTA_UNLOAD || mta == MTA_CARGO_LOAD || payment != NULL
|
|
|
|
* @return true if there are still packets that might be moved from this cargo list
|
|
|
|
* @return true if there are still packets that might be moved from this cargo list
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool MoveTo(CargoList *dest, uint count, CargoList::MoveToAction mta, CargoPayment *payment, uint data = 0);
|
|
|
|
template <class Tother_inst>
|
|
|
|
|
|
|
|
bool MoveTo(Tother_inst *dest, uint count, CargoList::MoveToAction mta, CargoPayment *payment, uint data = 0);
|
|
|
|
|
|
|
|
|
|
|
|
/** Invalidates the cached data and rebuild it */
|
|
|
|
/** Invalidates the cached data and rebuild it */
|
|
|
|
void InvalidateCache();
|
|
|
|
void InvalidateCache();
|
|
|
@ -294,7 +292,7 @@ public:
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* CargoList that is used for vehicles.
|
|
|
|
* CargoList that is used for vehicles.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
class VehicleCargoList : public CargoList {
|
|
|
|
class VehicleCargoList : public CargoList<VehicleCargoList> {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
/** The vehicles have a cargo list (and we want that saved). */
|
|
|
|
/** The vehicles have a cargo list (and we want that saved). */
|
|
|
|
friend const struct SaveLoad *GetVehicleDescription(VehicleType vt);
|
|
|
|
friend const struct SaveLoad *GetVehicleDescription(VehicleType vt);
|
|
|
@ -308,7 +306,7 @@ public:
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* CargoList that is used for stations.
|
|
|
|
* CargoList that is used for stations.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
class StationCargoList : public CargoList {
|
|
|
|
class StationCargoList : public CargoList<StationCargoList> {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
/** The stations, via GoodsEntry, have a CargoList. */
|
|
|
|
/** The stations, via GoodsEntry, have a CargoList. */
|
|
|
|
friend const struct SaveLoad *GetGoodsDesc();
|
|
|
|
friend const struct SaveLoad *GetGoodsDesc();
|
|
|
|