mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-06 19:01:04 +03:00
Fixed number of script classes being replaced by the number of threads, causing archive read to go wrong
This commit is contained in:
parent
73716dd624
commit
5521e7654d
1 changed files with 11 additions and 10 deletions
|
@ -893,38 +893,39 @@ void ScriptMaster::Archive(Archiver& arc)
|
||||||
ScriptClass *scr;
|
ScriptClass *scr;
|
||||||
ScriptVM *m_current;
|
ScriptVM *m_current;
|
||||||
ScriptThread *m_thread;
|
ScriptThread *m_thread;
|
||||||
int num;
|
int numClasses;
|
||||||
|
int numThreads;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
if (arc.Saving()) {
|
if (arc.Saving()) {
|
||||||
num = (int)ScriptClass_allocator.Count();
|
numClasses = (int)ScriptClass_allocator.Count();
|
||||||
arc.ArchiveInteger(&num);
|
arc.ArchiveInteger(&numClasses);
|
||||||
|
|
||||||
MEM_BlockAlloc_enum<ScriptClass> en = ScriptClass_allocator;
|
MEM_BlockAlloc_enum<ScriptClass> en = ScriptClass_allocator;
|
||||||
for (scr = en.NextElement(); scr != NULL; scr = en.NextElement()) {
|
for (scr = en.NextElement(); scr != NULL; scr = en.NextElement()) {
|
||||||
scr->ArchiveInternal(arc);
|
scr->ArchiveInternal(arc);
|
||||||
|
|
||||||
num = 0;
|
numThreads = 0;
|
||||||
for (m_current = scr->m_Threads; m_current != NULL; m_current = m_current->next) {
|
for (m_current = scr->m_Threads; m_current != NULL; m_current = m_current->next) {
|
||||||
num++;
|
numThreads++;
|
||||||
}
|
}
|
||||||
|
|
||||||
arc.ArchiveInteger(&num);
|
arc.ArchiveInteger(&numThreads);
|
||||||
|
|
||||||
for (m_current = scr->m_Threads; m_current != NULL; m_current = m_current->next) {
|
for (m_current = scr->m_Threads; m_current != NULL; m_current = m_current->next) {
|
||||||
m_current->m_Thread->ArchiveInternal(arc);
|
m_current->m_Thread->ArchiveInternal(arc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
arc.ArchiveInteger(&num);
|
arc.ArchiveInteger(&numClasses);
|
||||||
|
|
||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < numClasses; i++) {
|
||||||
scr = new ScriptClass();
|
scr = new ScriptClass();
|
||||||
scr->ArchiveInternal(arc);
|
scr->ArchiveInternal(arc);
|
||||||
|
|
||||||
arc.ArchiveInteger(&num);
|
arc.ArchiveInteger(&numThreads);
|
||||||
|
|
||||||
for (j = 0; j < num; j++) {
|
for (j = 0; j < numThreads; j++) {
|
||||||
m_thread = new ScriptThread(scr, NULL);
|
m_thread = new ScriptThread(scr, NULL);
|
||||||
m_thread->ArchiveInternal(arc);
|
m_thread->ArchiveInternal(arc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue