diff --git a/src/command.cpp b/src/command.cpp index c02796fef4..007fce35c3 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -262,7 +262,7 @@ void CommandHelperBase::InternalPostResult(const CommandCost &res, TileIndex til } } else if (estimate_only) { ShowEstimatedCostOrIncome(res.GetCost(), x, y); - } else if (!only_sending && res.GetCost() != 0 && tile != 0 && IsLocalCompany() && _game_mode != GM_EDITOR) { + } else if (!only_sending && tile != 0 && IsLocalCompany() && _game_mode != GM_EDITOR) { /* Only show the cost animation when we did actually * execute the command, i.e. we're not sending it to * the server, when it has cost the local company diff --git a/src/economy.cpp b/src/economy.cpp index fdccbd871b..e3a023f591 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1188,7 +1188,7 @@ CargoPayment::~CargoPayment() 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) { + } else { ShowCostOrIncomeAnimation(this->front->x_pos, this->front->y_pos, this->front->z_pos, -this->visual_profit); } diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index bc5179f82f..f0b60e63cb 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -565,7 +565,7 @@ void ShowEstimatedCostOrIncome(Money cost, int x, int y) } /** - * Display animated income or costs on the map. + * Display animated income or costs on the map. Does nothing if cost is zero. * @param x World X position of the animation location. * @param y World Y position of the animation location. * @param z World Z position of the animation location. @@ -573,6 +573,9 @@ void ShowEstimatedCostOrIncome(Money cost, int x, int y) */ void ShowCostOrIncomeAnimation(int x, int y, int z, Money cost) { + if (cost == 0) { + return; + } Point pt = RemapCoords(x, y, z); StringID msg = STR_INCOME_FLOAT_COST; diff --git a/src/vehicle.cpp b/src/vehicle.cpp index b2c92d7db3..3673337058 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1060,7 +1060,7 @@ void CallVehicleTicks() if (!IsLocalCompany()) continue; - if (res.Succeeded() && res.GetCost() != 0) { + if (res.Succeeded()) { ShowCostOrIncomeAnimation(x, y, z, res.GetCost()); continue; }