mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Only archive used variables on the local VM stack
This commit is contained in:
parent
e59200a7de
commit
2ac2800ecb
1 changed files with 4 additions and 1 deletions
|
@ -235,24 +235,27 @@ void ScriptVMStack::Archive(Archiver& arc)
|
||||||
{
|
{
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
|
unsigned int numVars;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (arc.Saving()) {
|
if (arc.Saving()) {
|
||||||
size = stackBottom - localStack;
|
size = stackBottom - localStack;
|
||||||
offset = pTop - localStack;
|
offset = pTop - localStack;
|
||||||
|
numVars = offset + 1;
|
||||||
|
|
||||||
arc.ArchiveUnsigned(&size);
|
arc.ArchiveUnsigned(&size);
|
||||||
arc.ArchiveUnsigned(&offset);
|
arc.ArchiveUnsigned(&offset);
|
||||||
} else {
|
} else {
|
||||||
arc.ArchiveUnsigned(&size);
|
arc.ArchiveUnsigned(&size);
|
||||||
arc.ArchiveUnsigned(&offset);
|
arc.ArchiveUnsigned(&offset);
|
||||||
|
numVars = offset + 1;
|
||||||
|
|
||||||
Allocate(size);
|
Allocate(size);
|
||||||
pTop = localStack + offset;
|
pTop = localStack + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localStack) {
|
if (localStack) {
|
||||||
for (i = 0; i < size; i++) {
|
for (i = 0; i < numVars; i++) {
|
||||||
localStack[i].ArchiveInternal(arc);
|
localStack[i].ArchiveInternal(arc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue