Reverted ScriptValue DataType from long to short

* for reasons unknown, it was the cause of random hang/crash when
running certain script sequences. (closes #517)

Updated version number.
This commit is contained in:
NovaRain
2024-04-18 22:21:41 +08:00
parent 7dc0681b4c
commit a19f9d0b83
4 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.4.3
;v4.4.3.1
[Main]
;Set to 1 to enable the built-in High Resolution Patch mode that is similar to the hi-res patch by Mash
+5 -4
View File
@@ -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<DWORD>(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<DataType>(elType & 0xFFFF); // for saved arrays from 4.4
if (el->type == DataType::STR) {
ReadFile(h, &el->len, 4, &unused, 0);
if (el->len > 0) {
+1 -1
View File
@@ -25,7 +25,7 @@ namespace sfall
namespace script
{
enum class DataType : unsigned long {
enum class DataType : unsigned short {
NONE = 0,
INT = 1,
FLOAT = 2,
+2 -2
View File
@@ -25,6 +25,6 @@
#define VERSION_MAJOR 4
#define VERSION_MINOR 4
#define VERSION_BUILD 3
#define VERSION_REV 0
#define VERSION_REV 1
#define VERSION_STRING "4.4.3"
#define VERSION_STRING "4.4.3.1"