# 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.
void | PayTransfer (CargoPacket *cp, uint count)
| Handle payment for transfer of the given cargo packet.
void | PayFinalDelivery (CargoPacket *cp, uint count)
| Handle payment for final delivery of the given cargo packet.
void | SetCargo (CargoID ct)
| Sets the currently handled cargo type.
bool | IsValid () const
## 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 15 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
  | destinations | List to add the destinations of 'our' cargo to

Definition at line 1445 of file economy.cpp.

## Member Function Documentation

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

Handle payment for transfer of the given cargo packet.

Parameters:

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

Definition at line 1507 of file economy.cpp.

References current_station, CargoPacket::days_in_transit, DistanceManhattan(), CargoPacket::feeder_share, CargoPacket::loaded_at_xy, and visual_profit.

Referenced by CargoList::MoveTo().

void CargoPayment::PayFinalDelivery | ( | 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 1488 of file economy.cpp.

References ct, CargoPacket::days_in_transit, DeliverGoods(), CargoPacket::feeder_share, front, route_profit, CargoPacket::source, CargoPacket::source_xy, and visual_profit.

Referenced by CargoList::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 37 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