diff options
author | rubidium <rubidium@openttd.org> | 2013-02-17 14:50:54 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2013-02-17 14:50:54 +0000 |
commit | 446d50f6580d6d71ac30d6d64b72cb3e5c4c3aaa (patch) | |
tree | 93495ae2a17ce8b5dcc66ae264f9aef50e09cbf0 /src/economy.cpp | |
parent | d6e2a8aa56337af68f2960cf404edf0ac03f405b (diff) | |
download | openttd-446d50f6580d6d71ac30d6d64b72cb3e5c4c3aaa.tar.xz |
(svn r25011) -Codechange: allow vehicle transfer and profit text effects to be shown at the same time (fonsinchen)
Diffstat (limited to 'src/economy.cpp')
-rw-r--r-- | src/economy.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index 7d055227e..c3745df33 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1140,21 +1140,23 @@ CargoPayment::~CargoPayment() this->front->cargo_payment = NULL; - if (this->visual_profit == 0) return; + if (this->visual_profit == 0 && this->visual_transfer == 0) return; Backup<CompanyByte> cur_company(_current_company, this->front->owner, FILE_LINE); SubtractMoneyFromCompany(CommandCost(this->front->GetExpenseType(true), -this->route_profit)); - this->front->profit_this_year += this->visual_profit << 8; + this->front->profit_this_year += (this->visual_profit + this->visual_transfer) << 8; - if (this->route_profit != 0) { - if (IsLocalCompany() && !PlayVehicleSound(this->front, VSE_LOAD_UNLOAD)) { - SndPlayVehicleFx(SND_14_CASHTILL, this->front); - } + if (this->route_profit != 0 && IsLocalCompany() && !PlayVehicleSound(this->front, VSE_LOAD_UNLOAD)) { + SndPlayVehicleFx(SND_14_CASHTILL, this->front); + } - ShowCostOrIncomeAnimation(this->front->x_pos, this->front->y_pos, this->front->z_pos, -this->visual_profit); - } else { - ShowFeederIncomeAnimation(this->front->x_pos, this->front->y_pos, this->front->z_pos, this->visual_profit); + if (this->visual_transfer != 0) { + ShowFeederIncomeAnimation(this->front->x_pos, this->front->y_pos, + this->front->z_pos, this->visual_transfer, -this->visual_profit); + } else if (this->visual_profit != 0) { + ShowCostOrIncomeAnimation(this->front->x_pos, this->front->y_pos, + this->front->z_pos, -this->visual_profit); } cur_company.Restore(); @@ -1196,7 +1198,7 @@ Money CargoPayment::PayTransfer(const CargoPacket *cp, uint count) profit = profit * _settings_game.economy.feeder_payment_share / 100; - this->visual_profit += profit; // accumulate transfer profits for whole vehicle + this->visual_transfer += profit; // accumulate transfer profits for whole vehicle return profit; // account for the (virtual) profit already made for the cargo packet } |