- fix initialization issues with a few serializer functions.

This commit is contained in:
Christoph Oelckers 2022-12-13 14:38:32 +01:00
parent 4cdb0c3c55
commit efd6d2cf07

View file

@ -294,7 +294,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)
@ -311,7 +315,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)
@ -324,7 +332,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)