diff --git a/src/saveload/extended_ver_sl.cpp b/src/saveload/extended_ver_sl.cpp index 37afb00c9f..ee45b2e08a 100644 --- a/src/saveload/extended_ver_sl.cpp +++ b/src/saveload/extended_ver_sl.cpp @@ -157,6 +157,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = { { XSLFI_DEPOT_ORDER_EXTRA_FLAGS,XSCF_IGNORABLE_UNKNOWN, 1, 1, "depot_order_extra_flags", nullptr, nullptr, nullptr }, { XSLFI_EXTRA_SIGNAL_TYPES, XSCF_NULL, 1, 1, "extra_signal_types", nullptr, nullptr, nullptr }, { XSLFI_BANKRUPTCY_EXTRA, XSCF_NULL, 1, 1, "bankruptcy_extra", nullptr, nullptr, nullptr }, + { XSLFI_SCRIPT_INT64, XSCF_NULL, 1, 1, "script_int64", nullptr, nullptr, nullptr }, { XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker }; diff --git a/src/saveload/extended_ver_sl.h b/src/saveload/extended_ver_sl.h index 200f668e20..1182459a5f 100644 --- a/src/saveload/extended_ver_sl.h +++ b/src/saveload/extended_ver_sl.h @@ -111,6 +111,7 @@ enum SlXvFeatureIndex { XSLFI_DEPOT_ORDER_EXTRA_FLAGS, ///< Depot order extra flags XSLFI_EXTRA_SIGNAL_TYPES, ///< Extra signal types XSLFI_BANKRUPTCY_EXTRA, ///< Extra company bankruptcy fields + XSLFI_SCRIPT_INT64, ///< See: SLV_SCRIPT_INT64 XSLFI_RIFF_HEADER_60_BIT, ///< Size field in RIFF chunk header is 60 bit XSLFI_HEIGHT_8_BIT, ///< Map tile height is 8 bit instead of 4 bit, but savegame version may be before this became true in trunk diff --git a/src/script/api/script_controller.hpp b/src/script/api/script_controller.hpp index bc2fc4870a..59da55e719 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 9b120113c1..f645260672 100644 --- a/src/script/script_instance.cpp +++ b/src/script/script_instance.cpp @@ -388,8 +388,8 @@ static const SaveLoad _script_byte[] = { SQInteger res; sq_getinteger(vm, index, &res); if (!test) { - int value = (int)res; - SlArray(&value, 1, SLE_INT32); + int64 value = (int64)res; + SlArray(&value, 1, SLE_INT64); } return true; } @@ -588,8 +588,8 @@ bool ScriptInstance::IsPaused() SlObject(nullptr, _script_byte); switch (_script_sl_byte) { case SQSL_INT: { - int value; - SlArray(&value, 1, SLE_INT32); + int64 value; + SlArray(&value, 1, (IsSavegameVersionBefore(SLV_SCRIPT_INT64) && SlXvIsFeatureMissing(XSLFI_SCRIPT_INT64)) ? SLE_FILE_I32 | SLE_VAR_I64 : SLE_INT64); if (vm != nullptr) sq_pushinteger(vm, (SQInteger)value); return true; }