- serialize 'spawned' object flag, WorldThingDestroyed event relies on it

https://forum.zdoom.org/viewtopic.php?t=60435
(cherry picked from commit 437b44bafb)
This commit is contained in:
alexey.lysiuk 2018-05-05 17:55:44 +03:00 committed by drfrag666
parent af92a66bae
commit a106594b6b

View file

@ -590,13 +590,20 @@ void DObject::SerializeUserVars(FSerializer &arc)
void DObject::Serialize(FSerializer &arc)
{
int fresh = ObjectFlags & OF_JustSpawned;
int freshdef = 0;
arc("justspawned", fresh, freshdef);
if (arc.isReading())
const auto SerializeFlag = [&](const char *const name, const EObjectFlags flag)
{
ObjectFlags |= fresh;
}
int value = ObjectFlags & flag;
int defaultvalue = 0;
arc(name, value, defaultvalue);
if (arc.isReading())
{
ObjectFlags |= value;
}
};
SerializeFlag("justspawned", OF_JustSpawned);
SerializeFlag("spawned", OF_Spawned);
ObjectFlags |= OF_SerialSuccess;
}