# CargoPacket Struct Reference

We want to use a pool. More...

`#include <cargopacket.h>`

Inheritance diagram for CargoPacket:

## Public Member Functions
| CargoPacket (StationID source=INVALID_STATION, uint16 count=0)
| Creates a new cargo packet.
virtual | ~CargoPacket ()
| Destroy the packet.
bool | IsValid () const
| Is this a valid cargo packet ?
bool | SameSource (const CargoPacket *cp) const
| Checks whether the cargo packet is from (exactly) the same source in time and location.
## Data Fields
StationID | source
| The station where the cargo came from first.
TileIndex | source_xy
| The origin of the cargo (first station in feeder chain).
TileIndex | loaded_at_xy
| Location where this cargo has been loaded into the vehicle.
uint16 | count
| The amount of cargo in this packet.
byte | days_in_transit
| Amount of days this packet has been in transit.
Money | feeder_share
| Value of feeder pickup to be paid for on delivery of cargo.
bool | paid_for
| Have we been paid for this cargo packet?

## Detailed Description

We want to use a pool.

Container for cargo from the same location and time

Definition at line 22 of file cargopacket.h.

## Constructor & Destructor Documentation

CargoPacket::CargoPacket | ( | StationID | source = `INVALID_STATION`,
|  | uint16 | count = `0` |
| ) |  |  |

Creates a new cargo packet.

Parameters:

  | source | the source of the packet
  | count | the number of cargo entities to put in this packet

Precondition:
  count != 0 || source == INVALID_STATION

Definition at line 21 of file cargopacket.cpp.

References days_in_transit, feeder_share, loaded_at_xy, paid_for, and source_xy.

## Member Function Documentation

bool CargoPacket::IsValid | ( |  | ) | const`[inline]`

Is this a valid cargo packet ?

Returns:
  true if and only it is valid

Definition at line 48 of file cargopacket.h.

Referenced by CargoList::Append().

bool CargoPacket::SameSource | ( | const CargoPacket * | cp | ) | const

Checks whether the cargo packet is from (exactly) the same source in time and location.

Parameters:

  | cp | the cargo packet to compare to

Returns:
  true if and only if days_in_transit and source_xy are equal

Definition at line 40 of file cargopacket.cpp.

References days_in_transit, paid_for, and source_xy.

The documentation for this struct was generated from the following files:

- src/cargopacket.h
- src/cargopacket.cpp