From 884c00ffeb3e2427abc793088d96c2b0f9fb5eeb Mon Sep 17 00:00:00 2001 From: NovaRain Date: Thu, 18 Apr 2024 22:23:39 +0800 Subject: [PATCH] Reverted ScriptValue DataType from long to short (sync with 4.x) Updated version number. --- artifacts/ddraw.ini | 2 +- sfall/Modules/Scripting/Arrays.cpp | 9 +++++---- sfall/Modules/Scripting/ScriptValue.h | 2 +- sfall/version.h | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/artifacts/ddraw.ini b/artifacts/ddraw.ini index 6700520b..7a83924a 100644 --- a/artifacts/ddraw.ini +++ b/artifacts/ddraw.ini @@ -1,5 +1,5 @@ ;sfall configuration settings -;v3.8.43 +;v3.8.43.1 [Main] ;Set to 1 if you want to use command line arguments to tell sfall to use another ini file diff --git a/sfall/Modules/Scripting/Arrays.cpp b/sfall/Modules/Scripting/Arrays.cpp index 3de6da3a..df6fee7e 100644 --- a/sfall/Modules/Scripting/Arrays.cpp +++ b/sfall/Modules/Scripting/Arrays.cpp @@ -188,7 +188,8 @@ void sArrayVar::clearAll() void SaveArrayElement(sArrayElement* el, HANDLE h) { DWORD unused; - WriteFile(h, &el->type, 4, &unused, 0); + DWORD elType = static_cast(el->type); // for interoperability with older versions + WriteFile(h, &elType, 4, &unused, 0); if (el->type == DATATYPE_STR) { WriteFile(h, &el->len, 4, &unused, 0); WriteFile(h, el->strVal, el->len, &unused, 0); @@ -199,9 +200,9 @@ void SaveArrayElement(sArrayElement* el, HANDLE h) bool LoadArrayElement(sArrayElement* el, HANDLE h) { - DWORD unused; - ReadFile(h, &el->type, 4, &unused, 0); - el->type = (DataType)((DWORD)el->type & 0xFFFF); // fix for saved arrays from 4.4 + DWORD elType, unused; + ReadFile(h, &elType, 4, &unused, 0); + el->type = static_cast(elType & 0xFFFF); // for saved arrays from 4.4 if (el->type == DATATYPE_STR) { ReadFile(h, &el->len, 4, &unused, 0); if (el->len > 0) { diff --git a/sfall/Modules/Scripting/ScriptValue.h b/sfall/Modules/Scripting/ScriptValue.h index 8b70b673..86ed6d97 100644 --- a/sfall/Modules/Scripting/ScriptValue.h +++ b/sfall/Modules/Scripting/ScriptValue.h @@ -25,7 +25,7 @@ namespace sfall namespace script { -enum DataType : unsigned long { +enum DataType : unsigned short { DATATYPE_NONE = 0, DATATYPE_INT = 1, DATATYPE_FLOAT = 2, diff --git a/sfall/version.h b/sfall/version.h index b39f3b55..d0c9fc78 100644 --- a/sfall/version.h +++ b/sfall/version.h @@ -25,6 +25,6 @@ #define VERSION_MAJOR 3 #define VERSION_MINOR 8 #define VERSION_BUILD 43 -#define VERSION_REV 0 +#define VERSION_REV 1 -#define VERSION_STRING "3.8.43" +#define VERSION_STRING "3.8.43.1"