|
OpenTTD Source 20251116-master-g21329071df
|
Helper class to perform the cargo payment. More...
#include <economy_base.h>
Public Member Functions | |
| CargoPayment () | |
| Constructor for pool saveload. | |
| CargoPayment (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. | |
Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_cargo_payment_pool > | |
| void * | operator new (size_t size) |
| Allocates space for new Titem. | |
| void * | operator new (size_t size, Tindex index) |
| Allocates space for new Titem with given index. | |
| void * | operator new (size_t, void *ptr) |
| Allocates space for new Titem at given memory address. | |
| void | operator delete (void *p, size_t size) |
| Marks Titem as free. | |
Data Fields | |
| StationID | current_station = StationID::Invalid() |
| NOSAVE: The current station. | |
| Vehicle * | front = 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. | |
Data Fields inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_cargo_payment_pool > | |
| Tindex | index |
| Index of this pool item. | |
Additional Inherited Members | |
Public Types inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_cargo_payment_pool > | |
| typedef struct Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache > | Pool |
| Type of the pool this item is going to be part of. | |
Static Public Member Functions inherited from Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_cargo_payment_pool > | |
| static bool | CanAllocateItem (size_t n=1) |
| Helper functions so we can use PoolItem::Function() instead of _poolitem_pool.Function() | |
| static bool | CleaningPool () |
| Returns current state of pool cleaning - yes or no. | |
| static bool | IsValidID (auto index) |
| Tests whether given index can be used to get valid (non-nullptr) Titem. | |
| static Titem * | Get (auto index) |
| Returns Titem with given index. | |
| static Titem * | GetIfValid (auto index) |
| Returns Titem with given index. | |
| static size_t | GetPoolSize () |
| Returns first unused index. | |
| static size_t | GetNumItems () |
| Returns number of valid items in the pool. | |
| static void | PostDestructor (size_t index) |
| Dummy function called after destructor of each member. | |
| static Pool::IterateWrapper< Titem > | Iterate (size_t from=0) |
| Returns an iterable ensemble of all valid Titem. | |
Helper class to perform the cargo payment.
Definition at line 23 of file economy_base.h.
|
inline |
Constructor for pool saveload.
Definition at line 33 of file economy_base.h.
| CargoPayment::CargoPayment | ( | Vehicle * | front | ) |
Makes us a new cargo payment helper.
| front | The front of the train |
Definition at line 1176 of file economy.cpp.
| CargoPayment::~CargoPayment | ( | ) |
Definition at line 1182 of file economy.cpp.
| void CargoPayment::PayFinalDelivery | ( | CargoType | cargo, |
| const CargoPacket * | cp, | ||
| uint | count, | ||
| TileIndex | current_tile | ||
| ) |
Handle payment for final delivery of the given cargo packet.
| cargo | The cargo type of the cargo. |
| cp | The cargo packet to pay for. |
| count | The number of packets to pay for. |
| current_tile | Current tile the payment is happening on. |
Definition at line 1217 of file economy.cpp.
References current_station, DeliverGoods(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Get(), CargoPacket::GetDistance(), CargoPacket::GetFeederShare(), CargoPacket::GetPeriodsInTransit(), CargoPacket::GetSource(), route_profit, and visual_profit.
Referenced by CargoDelivery::operator()().
| Money CargoPayment::PayTransfer | ( | CargoType | cargo, |
| const CargoPacket * | cp, | ||
| uint | count, | ||
| TileIndex | current_tile | ||
| ) |
Handle payment for transfer of the given cargo packet.
| cargo | The cargo type of the cargo. |
| cp | The cargo packet to pay for; actual payment won't be made!. |
| count | The number of packets to pay for. |
| current_tile | Current tile the payment is happening on. |
Definition at line 1235 of file economy.cpp.
References _settings_game, GameSettings::economy, EconomySettings::feeder_payment_share, CargoPacket::GetDistance(), CargoPacket::GetFeederShare(), CargoPacket::GetPeriodsInTransit(), and visual_transfer.
Referenced by VehicleCargoList::Stage().
| StationID CargoPayment::current_station = StationID::Invalid() |
NOSAVE: The current station.
Definition at line 25 of file economy_base.h.
Referenced by PayFinalDelivery().
| Vehicle* CargoPayment::front = nullptr |
The front vehicle to do the payment of.
Definition at line 27 of file economy_base.h.
| 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().
| Money CargoPayment::visual_profit = 0 |
The visual profit to show.
Definition at line 29 of file economy_base.h.
Referenced by PayFinalDelivery().
| Money CargoPayment::visual_transfer = 0 |
The transfer credits to be shown.
Definition at line 30 of file economy_base.h.
Referenced by PayTransfer().