OpenTTD Source 20241224-master-gee860a5c8e
CargoMovement< Tsource, Tdest > Class Template Reference

Abstract action for moving cargo from one list to another. More...

#include <cargoaction.h>

Inheritance diagram for CargoMovement< Tsource, Tdest >:
CargoReroute< StationCargoList > CargoReroute< VehicleCargoList > StationCargoReroute VehicleCargoReroute

Public Member Functions

 CargoMovement (Tsource *source, Tdest *destination, uint max_move)
 
uint MaxMove ()
 Returns how much more cargo can be moved with this action.
 

Protected Member Functions

CargoPacketPreprocess (CargoPacket *cp)
 Decides if a packet needs to be split.
 

Protected Attributes

Tsource * source
 Source of the cargo.
 
Tdest * destination
 Destination for the cargo.
 
uint max_move
 Maximum amount of cargo to be moved with this action.
 

Detailed Description

template<class Tsource, class Tdest>
class CargoMovement< Tsource, Tdest >

Abstract action for moving cargo from one list to another.

Template Parameters
TsourceCargoList subclass to remove cargo from.
TdestCargoList subclass to add cargo to.

Definition at line 56 of file cargoaction.h.

Constructor & Destructor Documentation

◆ CargoMovement()

template<class Tsource , class Tdest >
CargoMovement< Tsource, Tdest >::CargoMovement ( Tsource *  source,
Tdest *  destination,
uint  max_move 
)
inline

Definition at line 63 of file cargoaction.h.

Member Function Documentation

◆ MaxMove()

template<class Tsource , class Tdest >
uint CargoMovement< Tsource, Tdest >::MaxMove ( )
inline

Returns how much more cargo can be moved with this action.

Returns
Amount of cargo this action can still move.

Definition at line 69 of file cargoaction.h.

References CargoMovement< Tsource, Tdest >::max_move.

◆ Preprocess()

template<class Tsource , class Tdest >
CargoPacket * CargoMovement< Tsource, Tdest >::Preprocess ( CargoPacket cp)
protected

Decides if a packet needs to be split.

Parameters
cpPacket to be either split or moved in one piece.
Returns
Either new packet if splitting was necessary or the given one otherwise.

Definition at line 24 of file cargoaction.cpp.

Referenced by StationCargoReroute::operator()(), and VehicleCargoReroute::operator()().

Field Documentation

◆ destination

template<class Tsource , class Tdest >
Tdest* CargoMovement< Tsource, Tdest >::destination
protected

Destination for the cargo.

Definition at line 59 of file cargoaction.h.

Referenced by StationCargoReroute::operator()(), and VehicleCargoReroute::operator()().

◆ max_move

template<class Tsource , class Tdest >
uint CargoMovement< Tsource, Tdest >::max_move
protected

Maximum amount of cargo to be moved with this action.

Definition at line 60 of file cargoaction.h.

Referenced by CargoMovement< Tsource, Tdest >::MaxMove().

◆ source

template<class Tsource , class Tdest >
Tsource* CargoMovement< Tsource, Tdest >::source
protected

Source of the cargo.

Definition at line 58 of file cargoaction.h.

Referenced by StationCargoReroute::operator()(), and VehicleCargoReroute::operator()().


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