CargoList that is used for vehicles. More...
#include <cargopacket.h>
Public Member Functions | |
Money | FeederShare () const |
Returns total sum of the feeder share for all packets. | |
void | AgeCargo () |
Ages the all cargo in this list. | |
void | InvalidateCache () |
Invalidates the cached data and rebuild it. | |
Static Public Member Functions | |
static bool | AreMergable (const CargoPacket *cp1, const CargoPacket *cp2) |
Are two the two CargoPackets mergeable in the context of a list of CargoPackets for a Vehicle? | |
Protected Types | |
typedef CargoList < VehicleCargoList > | Parent |
The (direct) parent of this class. | |
Protected Member Functions | |
void | AddToCache (const CargoPacket *cp) |
Update the cache to reflect adding of this packet. | |
void | RemoveFromCache (const CargoPacket *cp) |
Update the cached values to reflect the removal of this packet. | |
Protected Attributes | |
Money | feeder_share |
Cache for the feeder share. | |
Friends | |
class | CargoList< VehicleCargoList > |
The super class ought to know what it's doing. | |
struct SaveLoad * | GetVehicleDescription (VehicleType vt) |
The vehicles have a cargo list (and we want that saved). |
CargoList that is used for vehicles.
Definition at line 260 of file cargopacket.h.
typedef CargoList<VehicleCargoList> VehicleCargoList::Parent [protected] |
The (direct) parent of this class.
Definition at line 263 of file cargopacket.h.
void VehicleCargoList::AddToCache | ( | const CargoPacket * | cp | ) | [protected] |
Update the cache to reflect adding of this packet.
Increases count, feeder share and days_in_transit.
cp | New packet to be inserted. |
Reimplemented from CargoList< VehicleCargoList >.
Definition at line 371 of file cargopacket.cpp.
References CargoList< VehicleCargoList >::AddToCache(), CargoPacket::feeder_share, and feeder_share.
static bool VehicleCargoList::AreMergable | ( | const CargoPacket * | cp1, | |
const CargoPacket * | cp2 | |||
) | [inline, static] |
Are two the two CargoPackets mergeable in the context of a list of CargoPackets for a Vehicle?
cp1 | First CargoPacket. | |
cp2 | Second CargoPacket. |
Definition at line 296 of file cargopacket.h.
References CargoPacket::days_in_transit, CargoPacket::loaded_at_xy, CargoPacket::source_id, CargoPacket::source_type, and CargoPacket::source_xy.
Money VehicleCargoList::FeederShare | ( | ) | const [inline] |
Returns total sum of the feeder share for all packets.
Definition at line 280 of file cargopacket.h.
References feeder_share.
Referenced by DrawRoadVehDetails(), and DrawShipDetails().
void VehicleCargoList::InvalidateCache | ( | ) |
Invalidates the cached data and rebuild it.
Reimplemented from CargoList< VehicleCargoList >.
Definition at line 393 of file cargopacket.cpp.
References feeder_share, and CargoList< VehicleCargoList >::InvalidateCache().
Referenced by CargoPacket::AfterLoad(), and CheckCaches().
void VehicleCargoList::RemoveFromCache | ( | const CargoPacket * | cp | ) | [protected] |
Update the cached values to reflect the removal of this packet.
Decreases count, feeder share and days_in_transit.
cp | Packet to be removed from cache. |
Reimplemented from CargoList< VehicleCargoList >.
Definition at line 360 of file cargopacket.cpp.
References CargoPacket::feeder_share, feeder_share, and CargoList< VehicleCargoList >::RemoveFromCache().
friend class CargoList< VehicleCargoList > [friend] |
The super class ought to know what it's doing.
Definition at line 272 of file cargopacket.h.
struct SaveLoad* GetVehicleDescription | ( | VehicleType | vt | ) | [friend] |
The vehicles have a cargo list (and we want that saved).
vt | the vehicle type. Can be VEH_END for the common vehicle description data |
Save and load of vehicles
Definition at line 549 of file vehicle_sl.cpp.