Changeset - r26243:a00e5a9a9739
[Not reviewed]
master
0 4 0
Charles Pigott - 2 years ago 2022-05-05 18:51:56
charlespigott@googlemail.com
Fix #9877: GS could trigger 'Cost: 0' cost message (#9878)
4 files changed with 7 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/command.cpp
Show inline comments
 
@@ -262,7 +262,7 @@ void CommandHelperBase::InternalPostResu
 
		}
 
	} 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
src/economy.cpp
Show inline comments
 
@@ -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);
 
	}
src/misc_gui.cpp
Show inline comments
 
@@ -565,7 +565,7 @@ void ShowEstimatedCostOrIncome(Money cos
 
}
 

	
 
/**
 
 * 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 cos
 
 */
 
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;
 

	
src/vehicle.cpp
Show inline comments
 
@@ -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;
 
		}
0 comments (0 inline, 0 general)