OpenTTD
Public Member Functions | Data Fields
CargoPayment Struct Reference

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

#include <economy_base.h>

Inheritance diagram for CargoPayment:
Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_cargo_payment_pool >

Public Member Functions

 CargoPayment ()
 Constructor for pool saveload.
 
 CargoPayment (Vehicle *front)
 Makes us a new cargo payment helper. More...
 
Money PayTransfer (const CargoPacket *cp, uint count)
 Handle payment for transfer of the given cargo packet. More...
 
void PayFinalDelivery (const CargoPacket *cp, uint count)
 Handle payment for final delivery of the given cargo packet. More...
 
void SetCargo (CargoID ct)
 Sets the currently handled cargo type. More...
 
- Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_cargo_payment_pool >
void * operator new (size_t size)
 Allocates space for new Titem. More...
 
void * operator new (size_t size, size_t index)
 Allocates space for new Titem with given index. More...
 
void * operator new (size_t size, void *ptr)
 Allocates space for new Titem at given memory address. More...
 
void operator delete (void *p)
 Marks Titem as free. More...
 

Data Fields

Vehiclefront
 The front vehicle to do the payment of.
 
Money route_profit
 The amount of money to add/remove from the bank account.
 
Money visual_profit
 The visual profit to show.
 
Money visual_transfer
 The transfer credits to be shown.
 
Companyowner
 The owner of the vehicle.
 
StationID current_station
 The current station.
 
CargoID ct
 The currently handled cargo type.
 
- Data Fields inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_cargo_payment_pool >
Tindex index
 Index of this pool item.
 

Additional Inherited Members

- Static Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_cargo_payment_pool >
static bool CanAllocateItem (size_t n=1)
 Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() More...
 
static bool CleaningPool ()
 Returns current state of pool cleaning - yes or no. More...
 
static bool IsValidID (size_t index)
 Tests whether given index can be used to get valid (non-NULL) Titem. More...
 
static Titem * Get (size_t index)
 Returns Titem with given index. More...
 
static Titem * GetIfValid (size_t index)
 Returns Titem with given index. More...
 
static size_t GetPoolSize ()
 Returns first unused index. More...
 
static size_t GetNumItems ()
 Returns number of valid items in the pool. More...
 
static void PostDestructor (size_t index)
 Dummy function called after destructor of each member. More...
 

Detailed Description

Helper class to perform the cargo payment.

Definition at line 26 of file economy_base.h.

Constructor & Destructor Documentation

◆ CargoPayment()

CargoPayment::CargoPayment ( Vehicle front)

Member Function Documentation

◆ PayFinalDelivery()

void CargoPayment::PayFinalDelivery ( const CargoPacket cp,
uint  count 
)

◆ PayTransfer()

Money CargoPayment::PayTransfer ( const CargoPacket cp,
uint  count 
)

Handle payment for transfer of the given cargo packet.

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

Definition at line 1227 of file economy.cpp.

Referenced by CargoPayment().

◆ SetCargo()

void CargoPayment::SetCargo ( CargoID  ct)
inline

Sets the currently handled cargo type.

Parameters
ctthe cargo type to handle from now on.

Definition at line 49 of file economy_base.h.

References ct.


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