- Blood: fixed AIState and posture data serialization

This commit is contained in:
Christoph Oelckers 2020-11-23 10:18:47 +01:00
parent 9a4073508d
commit 48049d5548
2 changed files with 9 additions and 1 deletions

View file

@ -410,6 +410,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, AISTATE*& w, AISTA
int i = 0;
if (arc.isWriting())
{
if (def && w == *def) return arc;
for (auto cstate : allAIStates)
{
if (w == cstate)
@ -509,9 +510,16 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, XSECTOR& w, XSECTO
FSerializer& Serialize(FSerializer& arc, const char* keyname, XSPRITE& w, XSPRITE* def)
{
static XSPRITE nul;
if (!def)
{
def = &nul;
if (arc.isReading()) w = {};
}
if (arc.BeginObject(keyname))
{
arc("flags", w.flags, def->flags)
("aistate", w.aiState, def->aiState)
("busy", w.busy, def->busy)
("reference", w.reference, def->reference)
("txid", w.txID, def->txID)

View file

@ -2300,7 +2300,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER*
("angold", w.angold)
("player_par", w.player_par)
("waterpal", w.nWaterPal)
.Array("posture", &w.pPosture[0][0], &gPostureDefaults[0][0], kModeMax * kPostureMax) // only save actual changes in this.
.Array("posturedata", &w.pPosture[0][0], &gPostureDefaults[0][0], kModeMax * kPostureMax) // only save actual changes in this.
.EndObject();
}
return arc;