summaryrefslogtreecommitdiffstats
path: root/src/control/Script.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-11 20:21:09 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-11 20:21:09 +0200
commit9b23e33c36facdad4b6f669501dbee7fa82ef50a (patch)
tree3f81b31669c2187720881afa07e2ed3db93d6694 /src/control/Script.cpp
parentMerge remote-tracking branch 'upstream/miami' into miami (diff)
parentMerge remote-tracking branch 'origin/master' into miami (diff)
downloadre3-9b23e33c36facdad4b6f669501dbee7fa82ef50a.tar
re3-9b23e33c36facdad4b6f669501dbee7fa82ef50a.tar.gz
re3-9b23e33c36facdad4b6f669501dbee7fa82ef50a.tar.bz2
re3-9b23e33c36facdad4b6f669501dbee7fa82ef50a.tar.lz
re3-9b23e33c36facdad4b6f669501dbee7fa82ef50a.tar.xz
re3-9b23e33c36facdad4b6f669501dbee7fa82ef50a.tar.zst
re3-9b23e33c36facdad4b6f669501dbee7fa82ef50a.zip
Diffstat (limited to 'src/control/Script.cpp')
-rw-r--r--src/control/Script.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 045a81fe..f6d5b2f0 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -11641,7 +11641,9 @@ INITSAVEBUF
WriteSaveBuf(buf, varSpace);
for (uint32 i = 0; i < varSpace; i++)
WriteSaveBuf(buf, ScriptSpace[i]);
+#ifdef CHECK_STRUCT_SIZES
static_assert(SCRIPT_DATA_SIZE == 968, "CTheScripts::SaveAllScripts");
+#endif
uint32 script_data_size = SCRIPT_DATA_SIZE;
WriteSaveBuf(buf, script_data_size);
WriteSaveBuf(buf, OnAMissionFlag);
@@ -12067,12 +12069,16 @@ void CRunningScript::Save(uint8*& buf)
for (int i = 0; i < 8; i++)
WriteSaveBuf<char>(buf, m_abScriptName[i]);
WriteSaveBuf<uint32>(buf, m_nIp);
+#ifdef CHECK_STRUCT_SIZES
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
+#endif
for (int i = 0; i < MAX_STACK_DEPTH; i++)
WriteSaveBuf<uint32>(buf, m_anStack[i]);
WriteSaveBuf<uint16>(buf, m_nStackPointer);
SkipSaveBuf(buf, 2);
+#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
+#endif
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
WriteSaveBuf<bool>(buf, m_bCondResult);
@@ -12098,12 +12104,16 @@ void CRunningScript::Load(uint8*& buf)
for (int i = 0; i < 8; i++)
m_abScriptName[i] = ReadSaveBuf<char>(buf);
m_nIp = ReadSaveBuf<uint32>(buf);
+#ifdef CHECK_STRUCT_SIZES
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
+#endif
for (int i = 0; i < MAX_STACK_DEPTH; i++)
m_anStack[i] = ReadSaveBuf<uint32>(buf);
m_nStackPointer = ReadSaveBuf<uint16>(buf);
SkipSaveBuf(buf, 2);
+#ifdef CHECK_STRUCT_SIZES
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
+#endif
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
m_bCondResult = ReadSaveBuf<bool>(buf);