# cargopacket.h File Reference

Base class for cargo packets. More...

`#include "core/pool_type.hpp"`
`#include "economy_type.h"`
`#include "tile_type.h"`
`#include "station_type.h"`
`#include "cargo_type.h"`
`#include "vehicle_type.h"`
`#include <list>`

Go to the source code of this file.

## Data Structures
struct | CargoPacket
| Container for cargo from the same location and time. More...
class | CargoList< Tinst >
| Simple collection class for a list of cargo packets. More...
class | VehicleCargoList
| CargoList that is used for vehicles. More...
class | StationCargoList
| CargoList that is used for stations. More...
## Defines
#define | FOR_ALL_CARGOPACKETS_FROM(var, start) FOR_ALL_ITEMS_FROM(CargoPacket, cargopacket_index, var, start)
| Iterate over all _valid_ cargo packets from the given start.
#define | FOR_ALL_CARGOPACKETS(var) FOR_ALL_CARGOPACKETS_FROM(var, 0)
| Iterate over all _valid_ cargo packets from the begin of the pool.
## Typedefs
typedef uint32 | CargoPacketID
| Unique identifier for a single cargo packet.
typedef Pool< CargoPacket, CargoPacketID, 1024, 1048576, true, false > | CargoPacketPool
| Type of the pool for cargo packets.
## Functions
struct SaveLoad * | GetCargoPacketDesc ()
| Wrapper function to get the CargoPacket's internal structure while some of the variables itself are private.
## Variables
CargoPacketPool | _cargopacket_pool
| The actual pool with cargo packets.

## Detailed Description

Base class for cargo packets.

Definition in file cargopacket.h.

## Define Documentation

#define FOR_ALL_CARGOPACKETS | ( | var |  | ) | FOR_ALL_CARGOPACKETS_FROM(var, 0)

Iterate over all _valid_ cargo packets from the begin of the pool.

Parameters:

  | var | the variable used as "iterator"

Definition at line 185 of file cargopacket.h.

Referenced by CargoPacket::InvalidateAllFrom().

#define FOR_ALL_CARGOPACKETS_FROM | ( | var,
|  | start |  | ) | FOR_ALL_ITEMS_FROM(CargoPacket, cargopacket_index, var, start)

Iterate over all _valid_ cargo packets from the given start.

Parameters:

  | var | the variable used as "iterator"
  | start | the cargo packet ID of the first packet to iterate over

Definition at line 179 of file cargopacket.h.

## Typedef Documentation

typedef uint32 CargoPacketID

Unique identifier for a single cargo packet.

Definition at line 24 of file cargopacket.h.

typedef Pool<CargoPacket, CargoPacketID, 1024, 1048576, true, false> CargoPacketPool

Type of the pool for cargo packets.

Definition at line 25 of file cargopacket.h.

## Function Documentation

struct SaveLoad* GetCargoPacketDesc | ( |  | ) | `[read]`

Wrapper function to get the CargoPacket's internal structure while some of the variables itself are private.

We want this to be saved, right?

Returns:
  the saveload description for CargoPackets.

Definition at line 84 of file cargopacket_sl.cpp.

References CargoPacket::count, CargoPacket::days_in_transit, CargoPacket::feeder_share, CargoPacket::loaded_at_xy, CargoPacket::source, CargoPacket::source_id, CargoPacket::source_type, and CargoPacket::source_xy.