serialization stuff

This commit is contained in:
Asuro
2025-03-24 14:21:31 +01:00
parent 551796e7ad
commit fa93abe1ec
6 changed files with 97 additions and 114 deletions

View File

@@ -42,8 +42,7 @@ namespace Puzzle
void LoadStaticPuzzleData()
{
Deserializer ser;
ser.Init("game/data/static/puzzle.dat");
if (ser.ReadT("SPUZ", StaticData))
if (ser.Init("game/data/static/puzzle.dat", "SPUZ") && ser.ReadT(StaticData))
{
LOG("Successfully loaded static puzzle data!");
}
@@ -54,8 +53,7 @@ namespace Puzzle
{
auto& data = GetStaticPuzzleData();
Serializer ser;
ser.Init("game/data/static/puzzle.dat");
if (ser.WriteT("SPUZ", GetStaticPuzzleData()))
if (ser.Init("game/data/static/puzzle.dat", "SPUZ") && ser.WriteT(GetStaticPuzzleData()))
{
LOG("Successfully saved static puzzle data!");
}
@@ -576,8 +574,7 @@ namespace Puzzle
char path[128]{0};
WritePuzzleFilePath(path, sizeof(path), obj.ID);
Serializer ser;
ser.Init(path);
if (ser.WriteT("PZZL", obj))
if (ser.Init(path, "PZZL") && ser.WriteT(obj))
{
LOG("Saved to %s", path);
}