src/cargopacket.h
changeset 9081 38b6cc9fd473
parent 9016 8d7d2a71fda5
child 9111 48ce04029fe4
equal deleted inserted replaced
9080:34bc7cbbb79a 9081:38b6cc9fd473
     9 #include "economy_type.h"
     9 #include "economy_type.h"
    10 #include "tile_type.h"
    10 #include "tile_type.h"
    11 #include "station_type.h"
    11 #include "station_type.h"
    12 #include <list>
    12 #include <list>
    13 
    13 
       
    14 struct BackuppedVehicle;
       
    15 
    14 typedef uint32 CargoPacketID;
    16 typedef uint32 CargoPacketID;
    15 struct CargoPacket;
    17 struct CargoPacket;
    16 
    18 
    17 /** We want to use a pool */
    19 /** We want to use a pool */
    18 DECLARE_OLD_POOL(CargoPacket, CargoPacket, 10, 1000)
    20 DECLARE_OLD_POOL(CargoPacket, CargoPacket, 10, 1000)
    54 	 * in time and location.
    56 	 * in time and location.
    55 	 * @param cp the cargo packet to compare to
    57 	 * @param cp the cargo packet to compare to
    56 	 * @return true if and only if days_in_transit and source_xy are equal
    58 	 * @return true if and only if days_in_transit and source_xy are equal
    57 	 */
    59 	 */
    58 	bool SameSource(const CargoPacket *cp) const;
    60 	bool SameSource(const CargoPacket *cp) const;
       
    61 
       
    62 	void RestoreBackup() const;
    59 };
    63 };
    60 
    64 
    61 /**
    65 /**
    62  * Iterate over all _valid_ cargo packets from the given start
    66  * Iterate over all _valid_ cargo packets from the given start
    63  * @param cp    the variable used as "iterator"
    67  * @param cp    the variable used as "iterator"
    97 	Money feeder_share;   ///< Cache for the feeder share
   101 	Money feeder_share;   ///< Cache for the feeder share
    98 	StationID source;     ///< Cache for the source of the packet
   102 	StationID source;     ///< Cache for the source of the packet
    99 	uint days_in_transit; ///< Cache for the number of days in transit
   103 	uint days_in_transit; ///< Cache for the number of days in transit
   100 
   104 
   101 public:
   105 public:
       
   106 	friend struct BackuppedVehicle;
   102 	friend void SaveLoad_STNS(Station *st);
   107 	friend void SaveLoad_STNS(Station *st);
   103 
   108 
   104 	/** Create the cargo list */
   109 	/** Create the cargo list */
   105 	CargoList() { this->InvalidateCache(); }
   110 	CargoList() { this->InvalidateCache(); }
   106 	/** And destroy it ("frees" all cargo packets) */
   111 	/** And destroy it ("frees" all cargo packets) */