diff --git a/src/economy.cpp b/src/economy.cpp index 5c75726592..3c0a736a90 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1242,11 +1242,13 @@ 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()); + profit -= cp->FeederShare(count); + /* For Infrastructure patch. Handling transfers between other companies */ - this->route_profit += profit - cp->FeederShare(count); + this->route_profit += profit; /* The vehicle's profit is whatever route profit there is minus feeder shares. */ - this->visual_profit += profit - cp->FeederShare(count); + this->visual_profit += profit; } /** @@ -1260,10 +1262,12 @@ Money CargoPayment::PayTransfer(const CargoPacket *cp, uint count) Money profit = GetTransportedGoodsIncome( count, /* pay transfer vehicle for only the part of transfer it has done: ie. cargo_loaded_at_xy to here */ - DistanceManhattan(cp->LoadedAtXY(), Station::Get(this->current_station)->xy), + DistanceManhattan(_settings_game.economy.feeder_payment_src_station ? cp->SourceStationXY() : cp->LoadedAtXY(), Station::Get(this->current_station)->xy), cp->DaysInTransit(), this->ct); + if (_settings_game.economy.feeder_payment_src_station) profit -= cp->FeederShare(count); + profit = profit * _settings_game.economy.feeder_payment_share / 100; /* For Infrastructure patch. Handling transfers between other companies */ diff --git a/src/lang/english.txt b/src/lang/english.txt index 5638c7f1a3..a667c7aa5d 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1630,6 +1630,8 @@ STR_CONFIG_SETTING_ALLOW_SHARES :Allow buying sh STR_CONFIG_SETTING_ALLOW_SHARES_HELPTEXT :When enabled, allow buying and selling of company shares. Shares will only be available for companies reaching a certain age STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE :Percentage of leg profit to pay in feeder systems: {STRING2} STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT :Percentage of income given to the intermediate legs in feeder systems, giving more control over the income +STR_CONFIG_SETTING_FEEDER_PAYMENT_SRC_STATION :Calculate leg profit relative to source station in feeder systems: {STRING2} +STR_CONFIG_SETTING_FEEDER_PAYMENT_SRC_STATION_HELPTEXT :When enabled, the calculation of leg profit in feeder systems is from the source station to the current point, minus any previous transfer payments, instead of calculating the current leg profit as an independent journey STR_CONFIG_SETTING_SIMULATE_SIGNALS :Simulate signals in tunnels, bridges every: {STRING2} STR_CONFIG_SETTING_SIMULATE_SIGNALS_VALUE :{COMMA} tile{P 0 "" s} STR_CONFIG_SETTING_DAY_LENGTH_FACTOR :Day length factor: {STRING2} diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 7fcfa6addf..ea0295f20e 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1660,6 +1660,7 @@ static SettingsContainer &GetSettingsTree() accounting->Add(new SettingEntry("difficulty.max_loan")); accounting->Add(new SettingEntry("difficulty.subsidy_multiplier")); accounting->Add(new SettingEntry("economy.feeder_payment_share")); + accounting->Add(new SettingEntry("economy.feeder_payment_src_station")); accounting->Add(new SettingEntry("economy.infrastructure_maintenance")); accounting->Add(new SettingEntry("difficulty.vehicle_costs")); accounting->Add(new SettingEntry("difficulty.construction_cost")); diff --git a/src/settings_type.h b/src/settings_type.h index 8138aa83b5..e825b1e2fb 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -529,6 +529,7 @@ struct EconomySettings { bool smooth_economy; ///< smooth economy bool allow_shares; ///< allow the buying/selling of shares uint8 feeder_payment_share; ///< percentage of leg payment to virtually pay in feeder systems + bool feeder_payment_src_station; ///< calculate leg payment relative to the source station, not the leg source byte dist_local_authority; ///< distance for town local authority, default 20 bool exclusive_rights; ///< allow buying exclusive rights bool fund_buildings; ///< allow funding new buildings diff --git a/src/table/settings.ini b/src/table/settings.ini index 3a7f8ca67d..8b00cdc9ab 100644 --- a/src/table/settings.ini +++ b/src/table/settings.ini @@ -1653,6 +1653,15 @@ strhelp = STR_CONFIG_SETTING_FEEDER_PAYMENT_SHARE_HELPTEXT strval = STR_CONFIG_SETTING_PERCENTAGE cat = SC_EXPERT +[SDT_BOOL] +base = GameSettings +var = economy.feeder_payment_src_station +def = false +str = STR_CONFIG_SETTING_FEEDER_PAYMENT_SRC_STATION +strhelp = STR_CONFIG_SETTING_FEEDER_PAYMENT_SRC_STATION_HELPTEXT +cat = SC_EXPERT +patxname = ""economy.feeder_payment_src_station"" + [SDT_XREF] xref = ""economy.day_length_factor"" extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_SPRINGPP)