OpenTTD Source 20260206-master-g4d4e37dbf1
CargoPayment Struct Reference

Helper class to perform the cargo payment. More...

#include <economy_base.h>

Inheritance diagram for CargoPayment:

Public Member Functions

 CargoPayment (CargoPaymentID index)
 CargoPayment (CargoPaymentID index, Vehicle *front)
 Makes us a new cargo payment helper.
Money PayTransfer (CargoType cargo, const CargoPacket *cp, uint count, TileIndex current_tile)
 Handle payment for transfer of the given cargo packet.
void PayFinalDelivery (CargoType cargo, const CargoPacket *cp, uint count, TileIndex current_tile)
 Handle payment for final delivery of the given cargo packet.

Data Fields

StationID current_station = StationID::Invalid()
 NOSAVE: The current station.
Vehiclefront = nullptr
 The front vehicle to do the payment of.
Money route_profit = 0
 The amount of money to add/remove from the bank account.
Money visual_profit = 0
 The visual profit to show.
Money visual_transfer = 0
 The transfer credits to be shown.

Detailed Description

Helper class to perform the cargo payment.

Definition at line 23 of file economy_base.h.

Constructor & Destructor Documentation

◆ CargoPayment() [1/2]

CargoPayment::CargoPayment ( CargoPaymentID index)
inline

Definition at line 32 of file economy_base.h.

◆ CargoPayment() [2/2]

CargoPayment::CargoPayment ( CargoPaymentID index,
Vehicle * front )

Makes us a new cargo payment helper.

Parameters
indexThe index into the cargo payment pool
frontThe front of the train

Definition at line 1168 of file economy.cpp.

References _cargo_payment_pool, current_station, and front.

◆ ~CargoPayment()

CargoPayment::~CargoPayment ( )

Definition at line 1175 of file economy.cpp.

Member Function Documentation

◆ PayFinalDelivery()

void CargoPayment::PayFinalDelivery ( CargoType cargo,
const CargoPacket * cp,
uint count,
TileIndex current_tile )

Handle payment for final delivery of the given cargo packet.

Parameters
cargoThe cargo type of the cargo.
cpThe cargo packet to pay for.
countThe number of packets to pay for.
current_tileCurrent tile the payment is happening on.

Definition at line 1210 of file economy.cpp.

References current_station, DeliverGoods(), CargoPacket::GetDistance(), CargoPacket::GetFeederShare(), CargoPacket::GetPeriodsInTransit(), CargoPacket::GetSource(), route_profit, and visual_profit.

◆ PayTransfer()

Money CargoPayment::PayTransfer ( CargoType cargo,
const CargoPacket * cp,
uint count,
TileIndex current_tile )

Handle payment for transfer of the given cargo packet.

Parameters
cargoThe cargo type of the cargo.
cpThe cargo packet to pay for; actual payment won't be made!.
countThe number of packets to pay for.
current_tileCurrent tile the payment is happening on.
Returns
The amount of money paid for the transfer.

Definition at line 1228 of file economy.cpp.

References _settings_game, CargoPacket::GetDistance(), CargoPacket::GetFeederShare(), CargoPacket::GetPeriodsInTransit(), and visual_transfer.

Referenced by VehicleCargoList::Stage().

Field Documentation

◆ current_station

StationID CargoPayment::current_station = StationID::Invalid()

NOSAVE: The current station.

Definition at line 25 of file economy_base.h.

Referenced by CargoPayment(), and PayFinalDelivery().

◆ front

Vehicle* CargoPayment::front = nullptr

The front vehicle to do the payment of.

Definition at line 27 of file economy_base.h.

Referenced by CargoPayment().

◆ route_profit

Money CargoPayment::route_profit = 0

The amount of money to add/remove from the bank account.

Definition at line 28 of file economy_base.h.

Referenced by PayFinalDelivery().

◆ visual_profit

Money CargoPayment::visual_profit = 0

The visual profit to show.

Definition at line 29 of file economy_base.h.

Referenced by PayFinalDelivery().

◆ visual_transfer

Money CargoPayment::visual_transfer = 0

The transfer credits to be shown.

Definition at line 30 of file economy_base.h.

Referenced by PayTransfer().


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