MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / PayFinalDelivery

Method PayFinalDelivery

src/economy.cpp:1217–1225  ·  view source on GitHub ↗

* Handle payment for final delivery of the given cargo packet. * @param cargo The cargo type of the cargo. * @param cp The cargo packet to pay for. * @param count The number of packets to pay for. * @param current_tile Current tile the payment is happening on. */

Source from the content-addressed store, hash-verified

1215 * @param current_tile Current tile the payment is happening on.
1216 */
1217void CargoPayment::PayFinalDelivery(CargoType cargo, const CargoPacket *cp, uint count, TileIndex current_tile)
1218{
1219 /* Handle end of route payment */
1220 Money profit = DeliverGoods(count, cargo, this->current_station, cp->GetDistance(current_tile), cp->GetPeriodsInTransit(), Company::Get(this->front->owner), cp->GetSource());
1221 this->route_profit += profit;
1222
1223 /* The vehicle's profit is whatever route profit there is minus feeder shares. */
1224 this->visual_profit += profit - cp->GetFeederShare(count);
1225}
1226
1227/**
1228 * Handle payment for transfer of the given cargo packet.

Callers 1

operator()Method · 0.80

Calls 5

DeliverGoodsFunction · 0.85
GetPeriodsInTransitMethod · 0.80
GetSourceMethod · 0.80
GetDistanceMethod · 0.45
GetFeederShareMethod · 0.45

Tested by

no test coverage detected