OpenTTD
Data Structures | Macros | Typedefs | Functions | Variables
cargopacket.h File Reference

Base class for cargo packets. More...

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

Go to the source code of this file.

Data Structures

class  CargoList< Tinst, Tcont >
 Simple collection class for a list of cargo packets. More...
 
struct  CargoPacket
 Container for cargo from the same location and time. More...
 
class  CargoList< Tinst, Tcont >
 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...
 

Macros

#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. More...
 
#define FOR_ALL_CARGOPACKETS(var)   FOR_ALL_CARGOPACKETS_FROM(var, 0)
 Iterate over all valid cargo packets from the begin of the pool. More...
 

Typedefs

typedef uint32 CargoPacketID
 Unique identifier for a single cargo packet. More...
 
typedef Pool< CargoPacket, CargoPacketID, 1024, 0xFFF000, PT_NORMAL, true, false > CargoPacketPool
 Type of the pool for cargo packets for a little over 16 million packets. More...
 
typedef uint32 TileOrStationID
 
typedef std::list< CargoPacket * > CargoPacketList
 
typedef MultiMap< StationID, CargoPacket * > StationCargoPacketMap
 
typedef std::map< StationID, uint > StationCargoAmountMap
 

Functions

const struct SaveLoadGetCargoPacketDesc ()
 Wrapper function to get the CargoPacket's internal structure while some of the variables itself are private. More...
 

Variables

CargoPacketPool _cargopacket_pool
 The actual pool with cargo packets. More...
 

Detailed Description

Base class for cargo packets.

Definition in file cargopacket.h.

Macro Definition Documentation

◆ FOR_ALL_CARGOPACKETS

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

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

Parameters
varVariable used as "iterator".

Definition at line 208 of file cargopacket.h.

Referenced by CargoPacket::InvalidateAllFrom(), and Save_CAPA().

◆ FOR_ALL_CARGOPACKETS_FROM

#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
varVariable used as "iterator".
startCargo packet ID of the first packet to iterate over.

Definition at line 202 of file cargopacket.h.

Typedef Documentation

◆ CargoPacketID

typedef uint32 CargoPacketID

Unique identifier for a single cargo packet.

Definition at line 25 of file cargopacket.h.

◆ CargoPacketPool

typedef Pool<CargoPacket, CargoPacketID, 1024, 0xFFF000, PT_NORMAL, true, false> CargoPacketPool

Type of the pool for cargo packets for a little over 16 million packets.

Definition at line 26 of file cargopacket.h.

Function Documentation

◆ GetCargoPacketDesc()

const struct SaveLoad* GetCargoPacketDesc ( )

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 94 of file cargopacket_sl.cpp.

References SLE_VAR, and CargoPacket::source.

Variable Documentation

◆ _cargopacket_pool

CargoPacketPool _cargopacket_pool

The actual pool with cargo packets.