OpenTTD Source: CargoTransfer Class Reference

OpenTTD Source 15.3

Public Member Functions | Protected Attributes
CargoTransfer Class Reference

Action of transferring cargo from a vehicle to a station. More...

`#include <cargoaction.h>`

Inheritance diagram for CargoTransfer:

## Public Member Functions
| CargoTransfer (VehicleCargoList *source, StationCargoList *destination, uint max_move, TileIndex current_tile)
bool | operator() (CargoPacket *cp)
| Transfers some cargo from a vehicle to a station.
Public Member Functions inherited from CargoMovement< VehicleCargoList, StationCargoList >
| CargoMovement (VehicleCargoList *source, StationCargoList *destination, uint max_move)
uint | MaxMove ()
| Returns how much more cargo can be moved with this action.

## Protected Attributes
TileIndex | current_tile
| Current tile cargo unloading is happening.
Protected Attributes inherited from CargoMovement< VehicleCargoList, StationCargoList >
VehicleCargoList * | source
| Source of the cargo.
StationCargoList * | destination
| Destination for the cargo.
uint | max_move
| Maximum amount of cargo to be moved with this action.

## Additional Inherited Members
Protected Member Functions inherited from CargoMovement< VehicleCargoList, StationCargoList >
CargoPacket * | Preprocess (CargoPacket *cp)
| Decides if a packet needs to be split.

## Detailed Description

Action of transferring cargo from a vehicle to a station.

Definition at line 73 of file cargoaction.h.

## Constructor & Destructor Documentation

## ◆ CargoTransfer()

CargoTransfer::CargoTransfer | ( | VehicleCargoList * | source,
|  | StationCargoList * | destination,
|  | uint | max_move,
|  | TileIndex | current_tile
| ) |  |
| inline

Definition at line 77 of file cargoaction.h.

## Member Function Documentation

## ◆ operator()()

bool CargoTransfer::operator() | ( | CargoPacket * | cp | ) |

Transfers some cargo from a vehicle to a station.

Parameters

  cp | Packet to be transferred.

Returns
  True if the packet was completely reserved, false if part of it was.

Definition at line 167 of file cargoaction.cpp.

References StationCargoList::Append(), CargoPacket::Count(), current_tile, CargoMovement< VehicleCargoList, StationCargoList >::destination, CargoPacket::GetNextHop(), CargoList< VehicleCargoList, CargoPacketList >::MTA_TRANSFER, CargoMovement< VehicleCargoList, StationCargoList >::Preprocess(), VehicleCargoList::RemoveFromMeta(), CargoMovement< VehicleCargoList, StationCargoList >::source, and CargoPacket::UpdateUnloadingTile().

## Field Documentation

## ◆ current_tile

TileIndex CargoTransfer::current_tile
| protected

Current tile cargo unloading is happening.

Definition at line 75 of file cargoaction.h.

Referenced by operator()().

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

- src/cargoaction.h
- src/cargoaction.cpp