OpenTTD Source 20260531-master-g0e951f3528
CargoReservation Class Reference

Action of reserving cargo from a station to be loaded onto a vehicle. More...

#include <cargoaction.h>

Inheritance diagram for CargoReservation:
CargoLoad CargoMovement< StationCargoList, VehicleCargoList >

Public Member Functions

 CargoReservation (StationCargoList *source, VehicleCargoList *destination, uint max_move, TileIndex current_tile)
bool operator() (CargoPacket *cp)
 Reserves some cargo for loading.
Public Member Functions inherited from CargoLoad
 CargoLoad (StationCargoList *source, VehicleCargoList *destination, uint max_move, TileIndex current_tile)
bool operator() (CargoPacket *cp)
 Loads some cargo onto a vehicle.
Public Member Functions inherited from CargoMovement< StationCargoList, VehicleCargoList >
 CargoMovement (StationCargoList *source, VehicleCargoList *destination, uint max_move)
 Create the movement.
uint MaxMove ()
 Returns how much more cargo can be moved with this action.

Additional Inherited Members

Protected Member Functions inherited from CargoMovement< StationCargoList, VehicleCargoList >
CargoPacketPreprocess (CargoPacket *cp)
 Decides if a packet needs to be split.
Protected Attributes inherited from CargoLoad
TileIndex current_tile
 Current tile cargo loading is happening.
Protected Attributes inherited from CargoMovement< StationCargoList, VehicleCargoList >
StationCargoListsource
 Source of the cargo.
VehicleCargoListdestination
 Destination for the cargo.
uint max_move
 Maximum amount of cargo to be moved with this action.

Detailed Description

Action of reserving cargo from a station to be loaded onto a vehicle.

Definition at line 112 of file cargoaction.h.

Constructor & Destructor Documentation

◆ CargoReservation()

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

Definition at line 114 of file cargoaction.h.

Member Function Documentation

◆ operator()()

bool CargoReservation::operator() ( CargoPacket * cp)

Reserves some cargo for loading.

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

Definition at line 134 of file cargoaction.cpp.

References CargoPacket::Count(), CargoLoad::current_tile, CargoMovement< StationCargoList, VehicleCargoList >::destination, CargoMovement< StationCargoList, VehicleCargoList >::Preprocess(), CargoMovement< StationCargoList, VehicleCargoList >::source, and CargoPacket::UpdateLoadingTile().


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