Abstract action of removing cargo from a vehicle or a station. More...
#include <cargoaction.h>
Public Member Functions | |
CargoRemoval (Tsource *source, uint max_move) | |
uint | MaxMove () |
Returns how much more cargo can be removed with this action. | |
bool | operator() (CargoPacket *cp) |
template<> | |
bool | operator() (CargoPacket *cp) |
Protected Member Functions | |
uint | Preprocess (CargoPacket *cp) |
Determines the amount of cargo to be removed from a packet and removes that from the metadata of the list. | |
bool | Postprocess (CargoPacket *cp, uint remove) |
Finalize cargo removal. | |
Protected Attributes | |
Tsource * | source |
Source of the cargo. | |
uint | max_move |
Maximum amount of cargo to be removed with this action. |
Abstract action of removing cargo from a vehicle or a station.
Tinst | Actual instantiation of this action. | |
Tsource | CargoList subclass to remove cargo from. |
Definition at line 23 of file cargoaction.h.
uint CargoRemoval< Tsource >::MaxMove | ( | ) | [inline] |
Returns how much more cargo can be removed with this action.
Definition at line 36 of file cargoaction.h.
bool CargoRemoval< StationCargoList >::operator() | ( | CargoPacket * | cp | ) |
cp | Packet to be removed. |
Definition at line 79 of file cargoaction.cpp.
References CargoRemoval< Tsource >::Postprocess(), CargoRemoval< Tsource >::Preprocess(), and CargoRemoval< Tsource >::source.
template bool CargoRemoval< Tsource >::Postprocess | ( | CargoPacket * | cp, | |
uint | remove | |||
) | [protected] |
Finalize cargo removal.
Either delete the packet or reduce it.
cp | Packet to be removed or reduced. | |
remove | Amount of cargo to be removed. |
Definition at line 61 of file cargoaction.cpp.
References CargoPacket::Count(), and CargoPacket::Reduce().
Referenced by CargoRemoval< Tsource >::operator()().
template uint CargoRemoval< Tsource >::Preprocess | ( | CargoPacket * | cp | ) | [protected] |
Determines the amount of cargo to be removed from a packet and removes that from the metadata of the list.
cp | Packet to be removed completely or partially. |
Definition at line 42 of file cargoaction.cpp.
References CargoPacket::Count(), and CargoRemoval< Tsource >::max_move.
Referenced by CargoRemoval< Tsource >::operator()().