OpenTTD Source 20260208-master-g43af8e94d0
CargoDelivery Class Reference

Action of final delivery of cargo. More...

#include <cargoaction.h>

Inheritance diagram for CargoDelivery:
CargoRemoval< VehicleCargoList >

Public Member Functions

 CargoDelivery (VehicleCargoList *source, uint max_move, CargoType cargo, CargoPayment *payment, TileIndex current_tile)
bool operator() (CargoPacket *cp)
 Delivers some cargo.
Public Member Functions inherited from CargoRemoval< VehicleCargoList >
bool operator() (CargoPacket *cp)
 Removes some cargo from a StationCargoList.
bool operator() (CargoPacket *cp)
 Removes some cargo from a VehicleCargoList.
 CargoRemoval (VehicleCargoList *source, uint max_move)
uint MaxMove ()
 Returns how much more cargo can be removed with this action.

Protected Attributes

TileIndex current_tile
 Current tile cargo delivery is happening.
CargoPaymentpayment
 Payment object where payments will be registered.
CargoType cargo
 The cargo type of the cargo.
Protected Attributes inherited from CargoRemoval< VehicleCargoList >
VehicleCargoListsource
 Source of the cargo.
uint max_move
 Maximum amount of cargo to be removed with this action.

Additional Inherited Members

Protected Member Functions inherited from CargoRemoval< VehicleCargoList >
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.

Detailed Description

Action of final delivery of cargo.

Definition at line 39 of file cargoaction.h.

Constructor & Destructor Documentation

◆ CargoDelivery()

CargoDelivery::CargoDelivery ( VehicleCargoList * source,
uint max_move,
CargoType cargo,
CargoPayment * payment,
TileIndex current_tile )
inline

Definition at line 45 of file cargoaction.h.

Member Function Documentation

◆ operator()()

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

Delivers some cargo.

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

Definition at line 106 of file cargoaction.cpp.

References cargo, current_tile, CargoList< VehicleCargoList, CargoPacketList >::MTA_DELIVER, payment, CargoRemoval< VehicleCargoList >::Postprocess(), CargoRemoval< VehicleCargoList >::Preprocess(), and CargoRemoval< VehicleCargoList >::source.

Field Documentation

◆ cargo

CargoType CargoDelivery::cargo
protected

The cargo type of the cargo.

Definition at line 43 of file cargoaction.h.

Referenced by operator()().

◆ current_tile

TileIndex CargoDelivery::current_tile
protected

Current tile cargo delivery is happening.

Definition at line 41 of file cargoaction.h.

Referenced by operator()().

◆ payment

CargoPayment* CargoDelivery::payment
protected

Payment object where payments will be registered.

Definition at line 42 of file cargoaction.h.

Referenced by operator()().


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