diff options
author | glx22 <glx@openttd.org> | 2020-12-27 23:38:45 +0100 |
---|---|---|
committer | glx22 <glx22@users.noreply.github.com> | 2020-12-28 16:51:15 +0100 |
commit | f7e48cac87e4f9dbf052a21d8221967903dbebfa (patch) | |
tree | 48c4c6a4ac0fe54f8eb699d8a6d25e7abe479aab /src/script/api | |
parent | 94057e9b181842e8d0cae1aaaada8e4ba6d131b9 (diff) | |
download | openttd-f7e48cac87e4f9dbf052a21d8221967903dbebfa.tar.xz |
Fix #8453: [Script] Don't truncate loan variation to 32bit
Diffstat (limited to 'src/script/api')
-rw-r--r-- | src/script/api/script_company.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/script/api/script_company.cpp b/src/script/api/script_company.cpp index 5769c97fa..93bba6332 100644 --- a/src/script/api/script_company.cpp +++ b/src/script/api/script_company.cpp @@ -204,8 +204,10 @@ if (loan == GetLoanAmount()) return true; + Money amount = abs(loan - GetLoanAmount()); + return ScriptObject::DoCommand(0, - abs(loan - GetLoanAmount()), 2, + amount >> 32, (amount & 0xFFFFFFFC) | 2, (loan > GetLoanAmount()) ? CMD_INCREASE_LOAN : CMD_DECREASE_LOAN); } |