From 781bf73c6de1b4b8c6c12505ef2ac6a49db94eba Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 28 Apr 2016 19:38:48 +0100 Subject: [PATCH] Fix incorrect calculation of final delivery payment. Calculation was incorrect for partial packet delivery after a transfer. --- src/economy.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/economy.cpp b/src/economy.cpp index 4c1cbc4644..364df17755 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1217,13 +1217,9 @@ void CargoPayment::PayFinalDelivery(const CargoPacket *cp, uint count) /* Handle end of route payment */ Money profit = DeliverGoods(count, this->ct, this->current_station, cp->SourceStationXY(), cp->DaysInTransit(), this->owner, cp->SourceSubsidyType(), cp->SourceSubsidyID()); -#ifndef INFRASTRUCTURE_FUNC_H - this->route_profit += profit; -#else - /* For Infrastructure patch. Handling transfers between other companies */ - this->route_profit += profit - cp->FeederShare(); -#endif + /* For Infrastructure patch. Handling transfers between other companies */ + this->route_profit += profit - cp->FeederShare(count); /* The vehicle's profit is whatever route profit there is minus feeder shares. */ this->visual_profit += profit - cp->FeederShare(count); @@ -1246,9 +1242,9 @@ Money CargoPayment::PayTransfer(const CargoPacket *cp, uint count) profit = profit * _settings_game.economy.feeder_payment_share / 100; -#ifdef INFRASTRUCTURE_FUNC_H + /* For Infrastructure patch. Handling transfers between other companies */ this->route_profit += profit; -#endif + this->visual_transfer += profit; // accumulate transfer profits for whole vehicle return profit; // account for the (virtual) profit already made for the cargo packet }