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

https://forum.zdoom.org/viewtopic.php?t=60435
This commit is contained in:
alexey.lysiuk 2018-05-05 17:55:44 +03:00
parent f4c49b6cff
commit 437b44bafb

View file

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