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

View file

@ -302,6 +302,40 @@ int CheckLink(int *x, int *y, int *z, int *nSector)
return 0; 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 class WarpLoadSave : public LoadSave
{ {
public: public: