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.
This commit is contained in:
Rubidium
2021-07-22 21:09:33 +02:00
committed by rubidium42
parent c1d79398d5
commit d83647f9a7
3 changed files with 3 additions and 3 deletions

View File

@@ -803,7 +803,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);