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

Method Save

src/WorldStorage/MapSerializer.cpp:64–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected