summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorLoïc Guilloux <glx22@users.noreply.github.com>2021-07-06 21:09:08 +0200
committerGitHub <noreply@github.com>2021-07-06 21:09:08 +0200
commitddafc0de054eb60bdeac4b1980c9021928b04511 (patch)
tree79e2918e58f2662d46043cb3cd5d957055195b87 /src/script
parent8913ae9ba8c37e5724d19cdad93161e939ab5ff6 (diff)
downloadopenttd-ddafc0de054eb60bdeac4b1980c9021928b04511.tar.xz
Fix 39e90ec: Integers for scripts are 64bit, but saved as 32bit (#9415)
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/script_controller.hpp4
-rw-r--r--src/script/script_instance.cpp8
2 files changed, 6 insertions, 6 deletions
diff --git a/src/script/api/script_controller.hpp b/src/script/api/script_controller.hpp
index c6b07232d..992a9ebf2 100644
--- a/src/script/api/script_controller.hpp
+++ b/src/script/api/script_controller.hpp
@@ -39,7 +39,7 @@
* data from the loaded game.
* - Finally, #Start is called to start execution of the script.
*
- * See also http://wiki.openttd.org/AI:Save/Load for more details.
+ * See also https://wiki.openttd.org/en/Development/Script/Save%20and%20Load for more details.
*
* @api ai game
*/
@@ -91,7 +91,7 @@ public:
* notified of the call. To avoid race-conditions between #Save and the
* other script code, change variables directly after a #Sleep, it is
* very unlikely, to get interrupted at that point in the execution.
- * See also http://wiki.openttd.org/AI:Save/Load for more details.
+ * See also https://wiki.openttd.org/en/Development/Script/Save%20and%20Load for more details.
*
* @note No other information is saved than the table returned by #Save.
* For example all pending events are lost as soon as the game is loaded.
diff --git a/src/script/script_instance.cpp b/src/script/script_instance.cpp
index 1d57383a9..3f611e66c 100644
--- a/src/script/script_instance.cpp
+++ b/src/script/script_instance.cpp
@@ -364,8 +364,8 @@ static const SaveLoad _script_byte[] = {
SQInteger res;
sq_getinteger(vm, index, &res);
if (!test) {
- int value = (int)res;
- SlCopy(&value, 1, SLE_INT32);
+ int64 value = (int64)res;
+ SlCopy(&value, 1, SLE_INT64);
}
return true;
}
@@ -564,8 +564,8 @@ bool ScriptInstance::IsPaused()
SlObject(nullptr, _script_byte);
switch (_script_sl_byte) {
case SQSL_INT: {
- int value;
- SlCopy(&value, 1, SLE_INT32);
+ int64 value;
+ SlCopy(&value, 1, IsSavegameVersionBefore(SLV_SCRIPT_INT64) ? SLE_INT32 : SLE_INT64);
if (vm != nullptr) sq_pushinteger(vm, (SQInteger)value);
return true;
}