OpenTTD Source  20241121-master-g67a0fccfad
StationCargoReroute Class Reference

Action of rerouting cargo in a station. More...

#include <cargoaction.h>

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

Public Member Functions

 StationCargoReroute (StationCargoList *source, StationCargoList *dest, uint max_move, StationID avoid, StationID avoid2, const GoodsEntry *ge)
 
bool operator() (CargoPacket *cp)
 Reroutes some cargo from one Station sublist to another. More...
 
- Public Member Functions inherited from CargoReroute< StationCargoList >
 CargoReroute (StationCargoList *source, StationCargoList *dest, uint max_move, StationID avoid, StationID avoid2, const GoodsEntry *ge)
 
- Public Member Functions inherited from CargoMovement< Tsource, Tdest >
 CargoMovement (Tsource *source, Tdest *destination, uint max_move)
 
uint MaxMove ()
 Returns how much more cargo can be moved with this action. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CargoMovement< Tsource, Tdest >
CargoPacketPreprocess (CargoPacket *cp)
 Decides if a packet needs to be split. More...
 
- Protected Attributes inherited from CargoReroute< StationCargoList >
StationID avoid
 
StationID avoid2
 
const GoodsEntryge
 
- Protected Attributes inherited from CargoMovement< Tsource, Tdest >
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

Action of rerouting cargo in a station.

Definition at line 132 of file cargoaction.h.

Member Function Documentation

◆ operator()()

bool StationCargoReroute::operator() ( CargoPacket cp)

Reroutes some cargo from one Station sublist to another.

Parameters
cpPacket to be rerouted.
Returns
True if the packet was completely rerouted, false if part of it was.

Definition at line 197 of file cargoaction.cpp.

References CargoPacket::Count(), CargoMovement< Tsource, Tdest >::destination, CargoPacket::GetFirstStation(), GoodsEntry::GetVia(), CargoMovement< Tsource, Tdest >::Preprocess(), and CargoMovement< Tsource, Tdest >::source.


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