Fix #9440: negative cargo payments not being handled right

Cargo payments were stored as unsigned integer, but cast to int64 during
application of inflation. However, then being multiplied with a uint64
making the result uint64. So in the end the payment that should have been
negative becomes hugely positive.

(cherry picked from commit d83647f9a7)
This commit is contained in:
Rubidium
2021-07-22 21:09:33 +02:00
committed by Jonathan G Rennison
parent e76c5dfda7
commit 230866ca3e
3 changed files with 3 additions and 3 deletions

View File

@@ -854,7 +854,7 @@ void RecomputePrices()
/* Setup cargo payment */
for (CargoSpec *cs : CargoSpec::Iterate()) {
cs->current_payment = ((int64)cs->initial_payment * _economy.inflation_payment) >> 16;
cs->current_payment = (cs->initial_payment * (int64)_economy.inflation_payment) >> 16;
}
SetWindowClassesDirty(WC_BUILD_VEHICLE);