MCPcopy Create free account
hub / github.com/cuberite/cuberite / Save

Method Save

src/WorldStorage/ScoreboardSerializer.cpp:63–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61
62
63bool cScoreboardSerializer::Save(void)
64{
65 cFastNBTWriter Writer;
66
67 SaveScoreboardToNBT(Writer);
68
69 Writer.Finish();
70
71 #ifdef _DEBUG
72 cParsedNBT TestParse(Writer.GetResult().data(), Writer.GetResult().size());
73 ASSERT(TestParse.IsValid());
74 #endif // _DEBUG
75
76 cFile File;
77 if (!File.Open(FILE_IO_PREFIX + m_Path, cFile::fmWrite))
78 {
79 return false;
80 }
81
82 AString Compressed;
83 int res = CompressStringGZIP(Writer.GetResult().data(), Writer.GetResult().size(), Compressed);
84
85 if (res != Z_OK)
86 {
87 return false;
88 }
89
90 File.Write(Compressed.data(), Compressed.size());
91 File.Close();
92
93 return true;
94}
95
96
97

Callers

nothing calls this directly

Calls 8

CompressStringGZIPFunction · 0.85
GetResultMethod · 0.80
sizeMethod · 0.80
FinishMethod · 0.45
IsValidMethod · 0.45
OpenMethod · 0.45
WriteMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected