- fixed: During hub travel, static thinkers may not be deserialized.

Since they are static, the version that got carried over from the last level will still be there and the more current version.
This commit is contained in:
Christoph Oelckers 2017-04-14 22:06:29 +02:00
parent 3d8821ee82
commit c73b71807b
2 changed files with 31 additions and 27 deletions

View file

@ -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();
}
}
}
}

View file

@ -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);