- JSON serializer for warp.cpp

This commit is contained in:
Christoph Oelckers 2020-11-21 19:39:24 +01:00
parent 678dedf224
commit 27dfefef6c
2 changed files with 36 additions and 2 deletions

View file

@ -729,7 +729,6 @@ void MirrorLoadSaveConstruct(void);
void PlayerLoadSaveConstruct(void);
void TriggersLoadSaveConstruct(void);
void ViewLoadSaveConstruct(void);
void WarpLoadSaveConstruct(void);
#ifdef NOONE_EXTENSIONS
void NNLoadSaveConstruct(void);
#endif
@ -747,7 +746,6 @@ void LoadSaveSetup(void)
PlayerLoadSaveConstruct();
TriggersLoadSaveConstruct();
ViewLoadSaveConstruct();
WarpLoadSaveConstruct();
#ifdef NOONE_EXTENSIONS
NNLoadSaveConstruct();
#endif
@ -756,6 +754,7 @@ void LoadSaveSetup(void)
void SerializeEvents(FSerializer& arc);
void SerializeSequences(FSerializer& arc);
void SerializeWarp(FSerializer& arc);
void GameInterface::SerializeGameState(FSerializer& arc)
{
@ -770,6 +769,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
SerializeEvents(arc);
SerializeSequences(arc);
SerializeWarp(arc);
}

View file

@ -302,6 +302,40 @@ int CheckLink(int *x, int *y, int *z, int *nSector)
return 0;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
FSerializer& Serialize(FSerializer& arc, const char* keyname, ZONE& w, ZONE* def)
{
if (arc.BeginObject(keyname))
{
arc("x", w.x)
("y", w.y)
("z", w.z)
("sector", w.sectnum)
("angle", w.ang)
.EndObject();
}
return arc;
}
void SerializeWarp(FSerializer& arc)
{
if (arc.BeginObject("warp"))
{
arc.Array("startzone", gStartZone, kMaxPlayers)
.Array("upperlink", gUpperLink, numsectors)
.Array("lowerlink", gLowerLink, numsectors)
.EndObject();
}
}
class WarpLoadSave : public LoadSave
{
public: