Skip to content

Commit

Permalink
- serialize 'spawned' object flag, WorldThingDestroyed event relies o…
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-lysiuk committed May 5, 2018
1 parent f4c49b6 commit 437b44b
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/dobject.cpp
Expand Up @@ -584,13 +584,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;
}

Expand Down

0 comments on commit 437b44b

Please sign in to comment.