- fix initialization issues with a few serializer functions.

This commit is contained in:
Christoph Oelckers 2022-12-13 14:38:32 +01:00
parent 7faac89288
commit 8445dbf94a

View file

@ -296,7 +296,11 @@ void DDukeActor::Serialize(FSerializer& arc)
FSerializer& Serialize(FSerializer& arc, const char* keyname, Cycler& w, Cycler* def) FSerializer& Serialize(FSerializer& arc, const char* keyname, Cycler& w, Cycler* def)
{ {
static Cycler nul; static Cycler nul;
if (!def) def = &nul; if (!def)
{
def = &nul;
if (arc.isReading()) w = {};
}
if (arc.BeginObject(keyname)) if (arc.BeginObject(keyname))
{ {
arc("sector", w.sector, def->sector) arc("sector", w.sector, def->sector)
@ -313,7 +317,11 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Cycler& w, Cycler*
FSerializer& Serialize(FSerializer& arc, const char* keyname, AmbientTags& w, AmbientTags* def) FSerializer& Serialize(FSerializer& arc, const char* keyname, AmbientTags& w, AmbientTags* def)
{ {
static AmbientTags nul; static AmbientTags nul;
if (!def) def = &nul; if (!def)
{
def = &nul;
if (arc.isReading()) w = {};
}
if (arc.BeginObject(keyname)) if (arc.BeginObject(keyname))
{ {
arc("lotag", w.lo, def->lo) arc("lotag", w.lo, def->lo)
@ -326,7 +334,11 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, AmbientTags& w, Am
FSerializer& Serialize(FSerializer& arc, const char* keyname, animate& w, animate* def) FSerializer& Serialize(FSerializer& arc, const char* keyname, animate& w, animate* def)
{ {
static animate nul; static animate nul;
if (!def) def = &nul; if (!def)
{
def = &nul;
if (arc.isReading()) w = {};
}
if (arc.BeginObject(keyname)) if (arc.BeginObject(keyname))
{ {
arc("sector", w.sect, def->sect) arc("sector", w.sect, def->sect)