OpenTTD Source: VehicleCargoList Class Reference

OpenTTD Source 15.0-beta1

Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
VehicleCargoList Class Reference

CargoList that is used for vehicles. More...

`#include <cargopacket.h>`

Inheritance diagram for VehicleCargoList:

## Public Member Functions
StationID | GetFirstStation () const
| Returns the first station of the first cargo packet in this list.
Money | GetFeederShare () const
| Returns total sum of the feeder share for all packets.
uint | ActionCount (MoveToAction action) const
| Returns the amount of cargo designated for a given purpose.
uint | StoredCount () const
| Returns sum of cargo on board the vehicle (ie not only reserved).
uint | TotalCount () const
| Returns sum of cargo, including reserved cargo.
uint | ReservedCount () const
| Returns sum of reserved cargo.
uint | UnloadCount () const
| Returns sum of cargo to be moved out of the vehicle at the current station.
uint | RemainingCount () const
| Returns the sum of cargo to be kept in the vehicle at the current station.
void | Append (CargoPacket *cp, MoveToAction action=MTA_KEEP)
| Appends the given cargo packet.
void | AgeCargo ()
| Ages the all cargo in this list.
void | InvalidateCache ()
| Invalidates the cached data and rebuild it.
bool | Stage (bool accepted, StationID current_station, StationIDStack next_station, uint8_t order_flags, const GoodsEntry *ge, CargoID cargo, CargoPayment *payment, TileIndex current_tile)
| Stages cargo for unloading.
void | KeepAll ()
| Marks all cargo in the vehicle as to be kept.
template<MoveToAction Tfrom, MoveToAction Tto>
uint | Reassign (uint max_move)
| Moves some cargo from one designation to another.
uint | Return (uint max_move, StationCargoList *dest, StationID next_station, TileIndex current_tile)
| Returns reserved cargo to the station and removes it from the cache.
uint | Unload (uint max_move, StationCargoList *dest, CargoID cargo, CargoPayment *payment, TileIndex current_tile)
| Unloads cargo at the given station.
uint | Shift (uint max_move, VehicleCargoList *dest)
| Shifts cargo between two vehicles.
uint | Truncate (uint max_move=UINT_MAX)
| Truncates the cargo in this list to the given amount.
uint | Reroute (uint max_move, VehicleCargoList *dest, StationID avoid, StationID avoid2, const GoodsEntry *ge)
| Routes packets with station "avoid" as next hop to a different place.
Public Member Functions inherited from CargoList< VehicleCargoList, CargoPacketList >
| CargoList ()
| Create the cargo list.
| ~CargoList ()
| Destroy the cargolist ("frees" all cargo packets).
void | OnCleanPool ()
| Empty the cargo list, but don't free the cargo packets; the cargo packets are cleaned by CargoPacket's CleanPool.
const CargoPacketList * | Packets () const
| Returns a pointer to the cargo packet list (so you can iterate over it etc).
uint | PeriodsInTransit () const
| Returns average number of cargo aging periods in transit for a cargo entity.
void | InvalidateCache ()
| Invalidates the cached data and rebuilds it.

## Static Public Member Functions
static bool | AreMergable (const CargoPacket *cp1, const CargoPacket *cp2)
| Are the two CargoPackets mergeable in the context of a list of CargoPackets for a Vehicle?

## Protected Types
typedef CargoList< VehicleCargoList, CargoPacketList > | Parent
| The (direct) parent of this class.

## Protected Member Functions
template<class Taction >
void | ShiftCargo (Taction action)
| Shifts cargo from the front of the packet list and applies some action to it.
template<class Taction >
void | PopCargo (Taction action)
| Pops cargo from the back of the packet list and applies some action to it.
void | AssertCountConsistency () const
| Assert that the designation counts add up.
void | AddToCache (const CargoPacket *cp)
| Update the cache to reflect adding of this packet.
void | RemoveFromCache (const CargoPacket *cp, uint count)
| Update the cached values to reflect the removal of this packet or part of it.
void | AddToMeta (const CargoPacket *cp, MoveToAction action)
| Adds a packet to the metadata.
void | RemoveFromMeta (const CargoPacket *cp, MoveToAction action, uint count)
| Removes a packet or part of it from the metadata.
Protected Member Functions inherited from CargoList< VehicleCargoList, CargoPacketList >
void | AddToCache (const CargoPacket *cp)
| Update the cache to reflect adding of this packet.
void | RemoveFromCache (const CargoPacket *cp, uint count)
| Update the cached values to reflect the removal of this packet or part of it.

## Static Protected Member Functions
static MoveToAction | ChooseAction (const CargoPacket *cp, StationID cargo_next, StationID current_station, bool accepted, StationIDStack next_station)
| Choose action to be performed with the given cargo packet.
Static Protected Member Functions inherited from CargoList< VehicleCargoList, CargoPacketList >
static bool | TryMerge (CargoPacket *cp, CargoPacket *icp)
| Tries to merge the second packet into the first and return if that was successful.

## Protected Attributes
Money | feeder_share
| Cache for the feeder share.
uint | action_counts [NUM_MOVE_TO_ACTION]
| Counts of cargo to be transferred, delivered, kept and loaded.
Protected Attributes inherited from CargoList< VehicleCargoList, CargoPacketList >
uint | count
| Cache for the number of cargo entities.
uint64_t | cargo_periods_in_transit
| Cache for the sum of number of cargo aging periods in transit of each entity; comparable to man-hours.
CargoPacketList | packets
| The cargo packets in this list.

## Friends
class | StationCargoList
| The station cargo list needs to control the unloading.
class | CargoList< VehicleCargoList, CargoPacketList >
| The super class ought to know what it's doing.
class | SlVehicleCommon
class | CargoShift
class | CargoTransfer
class | CargoDelivery
template<class Tsource >
class | CargoRemoval
class | CargoReturn
class | VehicleCargoReroute

## Additional Inherited Members
Public Types inherited from CargoList< VehicleCargoList, CargoPacketList >
enum | MoveToAction
| Kind of actions that could be done with packets on move. More...
typedef Tcont::iterator | Iterator
| The iterator for our container.
typedef Tcont::reverse_iterator | ReverseIterator
| The reverse iterator for our container.
typedef Tcont::const_iterator | ConstIterator
| The const iterator for our container.
typedef Tcont::const_reverse_iterator | ConstReverseIterator
| The const reverse iterator for our container.

## Detailed Description

CargoList that is used for vehicles.

Definition at line 351 of file cargopacket.h.

## Member Typedef Documentation

## ◆ Parent

typedef CargoList<VehicleCargoList, CargoPacketList> VehicleCargoList::Parent
| protected

The (direct) parent of this class.

Definition at line 354 of file cargopacket.h.

## Member Function Documentation

## ◆ ActionCount()

uint VehicleCargoList::ActionCount | ( | MoveToAction | action | ) | const
| inline

Returns the amount of cargo designated for a given purpose.

Parameters

  action | Action the cargo is designated for.

Returns
  Amount of cargo designated for the given action.

Definition at line 424 of file cargopacket.h.

Referenced by Vehicle::CancelReservation(), and StationCargoList::Load().

## ◆ AddToCache()

void VehicleCargoList::AddToCache | ( | const CargoPacket * | cp | ) |
| protected

Update the cache to reflect adding of this packet.

Increases count, feeder share and periods_in_transit.

Parameters

  cp | New packet to be inserted.

Definition at line 354 of file cargopacket.cpp.

References CargoList< VehicleCargoList, CargoPacketList >::AddToCache(), CargoPacket::feeder_share, and feeder_share.

Referenced by AddToMeta().

## ◆ AddToMeta()

void VehicleCargoList::AddToMeta | ( | const CargoPacket * | cp,
|  | MoveToAction | action
| ) |  |
| protected

Adds a packet to the metadata.

Parameters

  cp | Packet to be added.
  action | MoveToAction of the packet.

Definition at line 380 of file cargopacket.cpp.

References action_counts, AddToCache(), AssertCountConsistency(), and CargoPacket::count.

Referenced by Append().

## ◆ AgeCargo()

void VehicleCargoList::AgeCargo | ( |  | ) |

Ages the all cargo in this list.

Definition at line 391 of file cargopacket.cpp.

References CargoList< VehicleCargoList, CargoPacketList >::cargo_periods_in_transit, CargoPacket::count, CargoList< VehicleCargoList, CargoPacketList >::packets, and CargoPacket::periods_in_transit.

## ◆ Append()

void VehicleCargoList::Append | ( | CargoPacket * | cp,
|  | MoveToAction | action = `MTA_KEEP`
| ) |  |

Appends the given cargo packet.

Tries to merge it with another one in the packets list. If no fitting packet is found, appends it. You can only append packets to the ranges of packets designated for keeping or loading. Furthermore if there are already packets reserved for loading you cannot directly add packets to the "keep" list. You first have to load the reserved ones.

Warning
  After appending this packet may not exist anymore!

Note
  Do not use the cargo packet anymore after it has been appended to this CargoList!

Parameters

  cp | Cargo packet to add.
  action | Either MTA_KEEP if you want to add the packet directly or MTA_LOAD if you want to reserve it first.

Precondition
  cp != nullptr
  action == MTA_LOAD || (action == MTA_KEEP && this->designation_counts[MTA_LOAD] == 0)

Definition at line 260 of file cargopacket.cpp.

References action_counts, AddToMeta(), CargoPacket::count, CargoList< VehicleCargoList, CargoPacketList >::count, CargoList< VehicleCargoList, CargoPacketList >::MTA_KEEP, CargoList< VehicleCargoList, CargoPacketList >::MTA_LOAD, CargoList< VehicleCargoList, CargoPacketList >::packets, and CargoList< VehicleCargoList, CargoPacketList >::TryMerge().

Referenced by VEHSChunkHandler::Load(), CargoLoad::operator()(), CargoReservation::operator()(), and CargoShift::operator()().

## ◆ AreMergable()

static bool VehicleCargoList::AreMergable | ( | const CargoPacket * | cp1,
|  | const CargoPacket * | cp2
| ) |  |
| inlinestatic

Are the two CargoPackets mergeable in the context of a list of CargoPackets for a Vehicle?

Parameters

  cp1 | First CargoPacket.
  cp2 | Second CargoPacket.

Returns
  True if they are mergeable.

Definition at line 513 of file cargopacket.h.

References CargoPacket::first_station, CargoPacket::periods_in_transit, CargoPacket::source_id, CargoPacket::source_type, and CargoPacket::source_xy.

## ◆ AssertCountConsistency()

void VehicleCargoList::AssertCountConsistency | ( |  | ) | const
| inlineprotected

Assert that the designation counts add up.

Definition at line 368 of file cargopacket.h.

References CargoList< VehicleCargoList, CargoPacketList >::count, CargoList< VehicleCargoList, CargoPacketList >::MTA_DELIVER, CargoList< VehicleCargoList, CargoPacketList >::MTA_KEEP, CargoList< VehicleCargoList, CargoPacketList >::MTA_LOAD, and CargoList< VehicleCargoList, CargoPacketList >::MTA_TRANSFER.

Referenced by AddToMeta(), RemoveFromMeta(), and Stage().

## ◆ ChooseAction()

VehicleCargoList::MoveToAction VehicleCargoList::ChooseAction | ( | const CargoPacket * | cp,
|  | StationID | cargo_next,
|  | StationID | current_station,
|  | bool | accepted,
|  | StationIDStack | next_station
| ) |  |
| staticprotected

Choose action to be performed with the given cargo packet.

Parameters

  cp | The packet.
  cargo_next | Next hop the cargo wants to pass.
  current_station | Current station of the vehicle carrying the cargo.
  accepted | If the cargo is accepted at the current station.
  next_station | Next station(s) the vehicle may stop at.

Returns
  MoveToAction to be performed.

Definition at line 411 of file cargopacket.cpp.

References SmallStack< Titem, Tindex, Tinvalid, Tgrowth_step, Tmax_size >::Contains(), CargoPacket::first_station, CargoList< VehicleCargoList, CargoPacketList >::MTA_DELIVER, CargoList< VehicleCargoList, CargoPacketList >::MTA_KEEP, and CargoList< VehicleCargoList, CargoPacketList >::MTA_TRANSFER.

Referenced by Stage().

## ◆ GetFeederShare()

Money VehicleCargoList::GetFeederShare | ( |  | ) | const
| inline

Returns total sum of the feeder share for all packets.

Returns
  The before mentioned number.

Definition at line 414 of file cargopacket.h.

References feeder_share.

Referenced by DrawRoadVehDetails(), and DrawShipDetails().

## ◆ GetFirstStation()

StationID VehicleCargoList::GetFirstStation | ( |  | ) | const
| inline

Returns the first station of the first cargo packet in this list.

Returns
  The before mentioned station.

Definition at line 405 of file cargopacket.h.

References CargoList< VehicleCargoList, CargoPacketList >::count, and CargoList< VehicleCargoList, CargoPacketList >::packets.

Referenced by DrawRoadVehDetails(), DrawShipDetails(), and GetCargoSummaryOfArticulatedVehicle().

## ◆ InvalidateCache()

void VehicleCargoList::InvalidateCache | ( |  | ) |

Invalidates the cached data and rebuild it.

Definition at line 532 of file cargopacket.cpp.

References feeder_share, and CargoList< VehicleCargoList, CargoPacketList >::InvalidateCache().

## ◆ KeepAll()

void VehicleCargoList::KeepAll | ( |  | ) |
| inline

Marks all cargo in the vehicle as to be kept.

This is mostly useful for loading old savegames. When loading is aborted the reserved cargo has to be returned first.

Definition at line 488 of file cargopacket.h.

References CargoList< VehicleCargoList, CargoPacketList >::count, CargoList< VehicleCargoList, CargoPacketList >::MTA_DELIVER, CargoList< VehicleCargoList, CargoPacketList >::MTA_KEEP, CargoList< VehicleCargoList, CargoPacketList >::MTA_LOAD, and CargoList< VehicleCargoList, CargoPacketList >::MTA_TRANSFER.

Referenced by Vehicle::CancelReservation().

## ◆ PopCargo()

template<class Taction >

void VehicleCargoList::PopCargo | ( | Taction | action | ) |
| protected

Pops cargo from the back of the packet list and applies some action to it.

Template Parameters

  Taction | Action class or function to be used. It should define "bool operator()(CargoPacket *)". If true is returned the cargo packet will be removed from the list. Otherwise it will be kept and the loop will be aborted.

Parameters

  action | Action instance to be applied.

Definition at line 317 of file cargopacket.cpp.

References CargoList< VehicleCargoList, CargoPacketList >::packets.

Referenced by Return(), Shift(), and Truncate().

## ◆ Reassign()

template<VehicleCargoList::MoveToAction Tfrom, VehicleCargoList::MoveToAction Tto>

uint VehicleCargoList::Reassign | ( | uint | max_move | ) |

Moves some cargo from one designation to another.

You can only move between adjacent designations. E.g. you can keep cargo that was previously reserved (MTA_LOAD), but you can't reserve cargo that's marked as to be delivered. Furthermore, as this method doesn't change the actual packets, you cannot move cargo from or to MTA_TRANSFER. You need a specialized template method for that.

Template Parameters

  from | Previous designation of cargo.
  to | New designation of cargo.

Parameters

  max_move | Maximum amount of cargo to reassign.

Returns
  Amount of cargo actually reassigned.

Definition at line 551 of file cargopacket.cpp.

References action_counts, and CargoList< VehicleCargoList, CargoPacketList >::MTA_TRANSFER.

Referenced by StationCargoList::Load().

## ◆ RemainingCount()

uint VehicleCargoList::RemainingCount | ( |  | ) | const
| inline

Returns the sum of cargo to be kept in the vehicle at the current station.

Returns
  Cargo to be kept or loaded.

Definition at line 470 of file cargopacket.h.

References CargoList< VehicleCargoList, CargoPacketList >::MTA_KEEP, and CargoList< VehicleCargoList, CargoPacketList >::MTA_LOAD.

Referenced by FinalizeRefitAction::operator()().

## ◆ RemoveFromCache()

void VehicleCargoList::RemoveFromCache | ( | const CargoPacket * | cp,
|  | uint | count
| ) |  |
| protected

Update the cached values to reflect the removal of this packet or part of it.

Decreases count, feeder share and periods_in_transit.

Parameters

  cp | Packet to be removed from cache.
  count | Amount of cargo from the given packet to be removed.

Definition at line 343 of file cargopacket.cpp.

Referenced by RemoveFromMeta().

## ◆ RemoveFromMeta()

void VehicleCargoList::RemoveFromMeta | ( | const CargoPacket * | cp,
|  | MoveToAction | action,
|  | uint | count
| ) |  |
| protected

Removes a packet or part of it from the metadata.

Parameters

  cp | Packet to be removed.
  action | MoveToAction of the packet (for updating the counts).
  count | Amount of cargo to be removed.

Definition at line 366 of file cargopacket.cpp.

References action_counts, AssertCountConsistency(), CargoList< VehicleCargoList, CargoPacketList >::count, and RemoveFromCache().

Referenced by CargoDelivery::operator()(), CargoTransfer::operator()(), CargoReturn::operator()(), and CargoShift::operator()().

## ◆ Reroute()

uint VehicleCargoList::Reroute | ( | uint | max_move,
|  | VehicleCargoList * | dest,
|  | StationID | avoid,
|  | StationID | avoid2,
|  | const GoodsEntry * | ge
| ) |  |

Routes packets with station "avoid" as next hop to a different place.

Parameters

  max_move | Maximum amount of cargo to move.
  dest | List to prepend the cargo to.
  avoid | Station to exclude from routing and current next hop of packets to reroute.
  avoid2 | Additional station to exclude from routing.
  ge | GoodsEntry to get the routing info from.

Definition at line 665 of file cargopacket.cpp.

References action_counts, CargoList< VehicleCargoList, CargoPacketList >::MTA_TRANSFER, and ShiftCargo().

## ◆ ReservedCount()

uint VehicleCargoList::ReservedCount | ( |  | ) | const
| inline

Returns sum of reserved cargo.

Returns
  Sum of reserved cargo.

Definition at line 452 of file cargopacket.h.

References CargoList< VehicleCargoList, CargoPacketList >::MTA_LOAD.

Referenced by PrepareRefitAction::operator()().

## ◆ Return()

uint VehicleCargoList::Return | ( | uint | max_move,
|  | StationCargoList * | dest,
|  | StationID | next,
|  | TileIndex | current_tile
| ) |  |

Returns reserved cargo to the station and removes it from the cache.

Parameters

  max_move | Maximum amount of cargo to move.
  dest | Station the cargo is returned to.
  next | ID of the next station the cargo wants to go to.
  current_tile | Current tile the cargo handling is happening on.

Returns
  Amount of cargo actually returned.

Definition at line 598 of file cargopacket.cpp.

References action_counts, CargoList< VehicleCargoList, CargoPacketList >::MTA_LOAD, and PopCargo().

Referenced by Vehicle::CancelReservation(), and ReturnCargoAction::operator()().

## ◆ Shift()

uint VehicleCargoList::Shift | ( | uint | max_move,
|  | VehicleCargoList * | dest
| ) |  |

Shifts cargo between two vehicles.

Parameters

  dest | Other vehicle's cargo list.
  max_move | Maximum amount of cargo to be moved.

Returns
  Amount of cargo actually moved.

Definition at line 611 of file cargopacket.cpp.

References CargoList< VehicleCargoList, CargoPacketList >::count, and PopCargo().

## ◆ ShiftCargo()

template<class Taction >

void VehicleCargoList::ShiftCargo | ( | Taction | action | ) |
| protected

Shifts cargo from the front of the packet list and applies some action to it.

Template Parameters

  Taction | Action class or function to be used. It should define "bool operator()(CargoPacket *)". If true is returned the cargo packet will be removed from the list. Otherwise it will be kept and the loop will be aborted.

Parameters

  action | Action instance to be applied.

Definition at line 295 of file cargopacket.cpp.

References CargoList< VehicleCargoList, CargoPacketList >::packets.

Referenced by Reroute(), and Unload().

## ◆ Stage()

bool VehicleCargoList::Stage | ( | bool | accepted,
|  | StationID | current_station,
|  | StationIDStack | next_station,
|  | uint8_t | order_flags,
|  | const GoodsEntry * | ge,
|  | CargoID | cargo,
|  | CargoPayment * | payment,
|  | TileIndex | current_tile
| ) |  |

Stages cargo for unloading.

The cargo is sorted so that packets to be transferred, delivered or kept are in consecutive chunks in the list. At the same time the designation_counts are updated to reflect the size of those chunks.

Parameters

  accepted | If the cargo will be accepted at the station.
  current_station | ID of the station.
  next_station | ID of the station the vehicle will go to next.
  order_flags | OrderUnloadFlags that will apply to the unload operation.
  ge | GoodsEntry for getting the flows.
  cargo | The cargo type of the cargo.
  payment | Payment object for registering transfers.
  current_tile | Current tile the cargo handling is happening on. return If any cargo will be unloaded.

Definition at line 440 of file cargopacket.cpp.

References action_counts, CargoPacket::AddFeederShare(), AssertCountConsistency(), FlowStat::ChangeShare(), ChooseAction(), CargoPacket::count, CargoList< VehicleCargoList, CargoPacketList >::count, feeder_share, CargoPacket::first_station, GoodsEntry::flows, FlowStat::GetShares(), FlowStat::GetVia(), SmallStack< Titem, Tindex, Tinvalid, Tgrowth_step, Tmax_size >::IsEmpty(), CargoList< VehicleCargoList, CargoPacketList >::MTA_DELIVER, CargoList< VehicleCargoList, CargoPacketList >::MTA_KEEP, CargoList< VehicleCargoList, CargoPacketList >::MTA_LOAD, CargoList< VehicleCargoList, CargoPacketList >::MTA_TRANSFER, CargoPacket::next_hop, OUFB_NO_UNLOAD, OUFB_TRANSFER, OUFB_UNLOAD, CargoList< VehicleCargoList, CargoPacketList >::packets, CargoPayment::PayTransfer(), and SmallStack< Titem, Tindex, Tinvalid, Tgrowth_step, Tmax_size >::Pop().

## ◆ StoredCount()

uint VehicleCargoList::StoredCount | ( |  | ) | const
| inline

Returns sum of cargo on board the vehicle (ie not only reserved).

Returns
  Cargo on board the vehicle.

Definition at line 434 of file cargopacket.h.

References CargoList< VehicleCargoList, CargoPacketList >::count, and CargoList< VehicleCargoList, CargoPacketList >::MTA_LOAD.

Referenced by CalcPercentVehicleFilled(), DrawRoadVehDetails(), DrawShipDetails(), GetCargoSummaryOfArticulatedVehicle(), RoadVehicle::GetImage(), Train::GetImage(), RoadVehicle::GetWeight(), Train::GetWeight(), IncreaseStats(), LoadUnloadVehicle(), IsEmptyAction::operator()(), and VehicleResolverObject::ResolveReal().

## ◆ TotalCount()

uint VehicleCargoList::TotalCount | ( |  | ) | const
| inline

Returns sum of cargo, including reserved cargo.

Returns
  Sum of cargo.

Definition at line 443 of file cargopacket.h.

References CargoList< VehicleCargoList, CargoPacketList >::count.

Referenced by RefitVehicle(), and TransferCargo().

## ◆ Truncate()

uint VehicleCargoList::Truncate | ( | uint | max_move = `UINT_MAX` | ) |

Truncates the cargo in this list to the given amount.

It leaves the first cargo entities and removes max_move from the back of the list.

Parameters

  max_move | Maximum amount of entities to be removed from the list.

Returns
  Amount of entities actually moved.

Definition at line 650 of file cargopacket.cpp.

References CargoList< VehicleCargoList, CargoPacketList >::count, and PopCargo().

Referenced by CrashAirplane(), Vehicle::PreDestructor(), and RefitVehicle().

## ◆ Unload()

uint VehicleCargoList::Unload | ( | uint | max_move,
|  | StationCargoList * | dest,
|  | CargoID | cargo,
|  | CargoPayment * | payment,
|  | TileIndex | current_tile
| ) |  |

Unloads cargo at the given station.

Deliver or transfer, depending on the ranges defined by designation_counts.

Parameters

  dest | StationCargoList to add transferred cargo to.
  max_move | Maximum amount of cargo to move.
  cargo | The cargo type of the cargo.
  payment | Payment object to register payments in.
  current_tile | Current tile the cargo handling is happening on.

Returns
  Amount of cargo actually unloaded.

Definition at line 628 of file cargopacket.cpp.

References action_counts, CargoList< VehicleCargoList, CargoPacketList >::MTA_DELIVER, CargoList< VehicleCargoList, CargoPacketList >::MTA_TRANSFER, and ShiftCargo().

## ◆ UnloadCount()

uint VehicleCargoList::UnloadCount | ( |  | ) | const
| inline

Returns sum of cargo to be moved out of the vehicle at the current station.

Returns
  Cargo to be moved.

Definition at line 461 of file cargopacket.h.

References CargoList< VehicleCargoList, CargoPacketList >::MTA_DELIVER, and CargoList< VehicleCargoList, CargoPacketList >::MTA_TRANSFER.

## Friends And Related Symbol Documentation

## ◆ CargoDelivery

friend class CargoDelivery
| friend

Definition at line 395 of file cargopacket.h.

## ◆ CargoList< VehicleCargoList, CargoPacketList >

friend class CargoList< VehicleCargoList, CargoPacketList >
| friend

The super class ought to know what it's doing.

Definition at line 387 of file cargopacket.h.

## ◆ CargoRemoval

template<class Tsource >

friend class CargoRemoval
| friend

Definition at line 397 of file cargopacket.h.

## ◆ CargoReturn

friend class CargoReturn
| friend

Definition at line 398 of file cargopacket.h.

## ◆ CargoShift

friend class CargoShift
| friend

Definition at line 393 of file cargopacket.h.

## ◆ CargoTransfer

friend class CargoTransfer
| friend

Definition at line 394 of file cargopacket.h.

## ◆ SlVehicleCommon

friend class SlVehicleCommon
| friend

Definition at line 391 of file cargopacket.h.

## ◆ StationCargoList

friend class StationCargoList
| friend

The station cargo list needs to control the unloading.

Definition at line 387 of file cargopacket.h.

## ◆ VehicleCargoReroute

friend class VehicleCargoReroute
| friend

Definition at line 399 of file cargopacket.h.

## Field Documentation

## ◆ action_counts

uint VehicleCargoList::action_counts[NUM_MOVE_TO_ACTION]
| protected

Counts of cargo to be transferred, delivered, kept and loaded.

Definition at line 357 of file cargopacket.h.

Referenced by AddToMeta(), Append(), Reassign(), RemoveFromMeta(), Reroute(), Return(), Stage(), and Unload().

## ◆ feeder_share

Money VehicleCargoList::feeder_share
| protected

Cache for the feeder share.

Definition at line 356 of file cargopacket.h.

Referenced by AddToCache(), GetFeederShare(), CargoList< StationCargoList, StationCargoPacketMap >::InvalidateCache(), InvalidateCache(), and Stage().

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

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