# CargoPayment Struct Reference

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

`#include <economy_base.h>`

Inheritance diagram for CargoPayment:

## Public Member Functions
| CargoPayment ()
| Constructor for pool saveload.
| CargoPayment (Vehicle *front)
| Makes us a new cargo payment helper.
Money | PayTransfer (const CargoPacket *cp, uint count)
| Handle payment for transfer of the given cargo packet.
void | PayFinalDelivery (const CargoPacket *cp, uint count)
| Handle payment for final delivery of the given cargo packet.
void | SetCargo (CargoID ct)
| Sets the currently handled cargo type.
## Data Fields
Vehicle * | front
| 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.
Company * | owner
| The owner of the vehicle.
StationID | current_station
| The current station.
CargoID | ct
| The currently handled cargo type.

## Detailed Description

Helper class to perform the cargo payment.

Definition at line 26 of file economy_base.h.

## Constructor & Destructor Documentation

CargoPayment::CargoPayment | ( | Vehicle * | front | ) |

Makes us a new cargo payment helper.

Parameters:

  | front | The front of the train

Definition at line 1011 of file economy.cpp.

## Member Function Documentation

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

Handle payment for final delivery of the given cargo packet.

Parameters:

  | cp | The cargo packet to pay for.
  | count | The number of packets to pay for.

Definition at line 1049 of file economy.cpp.

References ct, current_station, CargoPacket::DaysInTransit(), DeliverGoods(), CargoPacket::FeederShare(), front, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_cargo_payment_pool >::Get(), owner, route_profit, CargoPacket::SourceStationXY(), CargoPacket::SourceSubsidyID(), CargoPacket::SourceSubsidyType(), and visual_profit.

Referenced by CargoList< Tinst >::MoveTo().

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

Handle payment for transfer of the given cargo packet.

Parameters:

  | cp | The cargo packet to pay for; actual payment won't be made!.
  | count | The number of packets to pay for.

Returns:
  The amount of money paid for the transfer.

Definition at line 1069 of file economy.cpp.

References _settings_game, ct, current_station, CargoPacket::DaysInTransit(), DistanceManhattan(), GameSettings::economy, EconomySettings::feeder_payment_share, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_cargo_payment_pool >::Get(), CargoPacket::LoadedAtXY(), and visual_profit.

Referenced by CargoList< Tinst >::MoveTo().

void CargoPayment::SetCargo | ( | CargoID | ct | ) | `[inline]`

Sets the currently handled cargo type.

Parameters:

  | ct | the cargo type to handle from now on.

Definition at line 48 of file economy_base.h.

Referenced by LoadUnloadVehicle().

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

- src/economy_base.h
- src/economy.cpp