diff options
author | Rubidium <rubidium@openttd.org> | 2021-07-22 21:09:33 +0200 |
---|---|---|
committer | rubidium42 <rubidium42@users.noreply.github.com> | 2021-08-02 20:44:53 +0200 |
commit | d83647f9a7aaa2adb5ffa1042613f256134a9e1d (patch) | |
tree | 07c791291bcc9cd35709abc25745ec74df5b026c /src/economy.cpp | |
parent | c1d79398d57b4b8a013fcca62e72a5ce9efc137f (diff) | |
download | openttd-d83647f9a7aaa2adb5ffa1042613f256134a9e1d.tar.xz |
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.
Diffstat (limited to 'src/economy.cpp')
-rw-r--r-- | src/economy.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index c3332c4d1..936fba789 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -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); |