diff --git a/src/dthinker.cpp b/src/dthinker.cpp index d68939665..5e5360651 100644 --- a/src/dthinker.cpp +++ b/src/dthinker.cpp @@ -179,37 +179,41 @@ void DThinker::SerializeThinkers(FSerializer &arc, bool hubLoad) { for (i = 0; i <= MAX_STATNUM; i++) { + if (arc.BeginArray(nullptr)) { - int size = arc.ArraySize(); - for (int j = 0; j < size; j++) + if (!hubLoad || i != STAT_STATIC) // do not load static thinkers in a hub transition because they'd just duplicate the active ones. { - DThinker *thinker = nullptr; - arc(nullptr, thinker); - if (thinker != nullptr) + int size = arc.ArraySize(); + for (int j = 0; j < size; j++) { - // This may be a player stored in their ancillary list. Remove - // them first before inserting them into the new list. - if (thinker->NextThinker != nullptr) + DThinker *thinker = nullptr; + arc(nullptr, thinker); + if (thinker != nullptr) { - thinker->Remove(); - } - // Thinkers with the OF_JustSpawned flag set go in the FreshThinkers - // list. Anything else goes in the regular Thinkers list. - if (thinker->ObjectFlags & OF_EuthanizeMe) - { - // This thinker was destroyed during the loading process. Do - // not link it into any list. - } - else if (thinker->ObjectFlags & OF_JustSpawned) - { - FreshThinkers[i].AddTail(thinker); - thinker->PostSerialize(); - } - else - { - Thinkers[i].AddTail(thinker); - thinker->PostSerialize(); + // This may be a player stored in their ancillary list. Remove + // them first before inserting them into the new list. + if (thinker->NextThinker != nullptr) + { + thinker->Remove(); + } + // Thinkers with the OF_JustSpawned flag set go in the FreshThinkers + // list. Anything else goes in the regular Thinkers list. + if (thinker->ObjectFlags & OF_EuthanizeMe) + { + // This thinker was destroyed during the loading process. Do + // not link it into any list. + } + else if (thinker->ObjectFlags & OF_JustSpawned) + { + FreshThinkers[i].AddTail(thinker); + thinker->PostSerialize(); + } + else + { + Thinkers[i].AddTail(thinker); + thinker->PostSerialize(); + } } } } diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index b20e9af09..6c8d29973 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -996,7 +996,7 @@ void G_SerializeLevel(FSerializer &arc, bool hubload) // [ZZ] serialize events E_SerializeEvents(arc); - DThinker::SerializeThinkers(arc, !hubload); + DThinker::SerializeThinkers(arc, hubload); arc.Array("polyobjs", polyobjs, po_NumPolyobjs); SerializeSubsectors(arc, "subsectors"); StatusBar->SerializeMessages(arc);