diff options
author | andrew <xdotftw@gmail.com> | 2014-01-22 14:49:21 +0100 |
---|---|---|
committer | andrew <xdotftw@gmail.com> | 2014-01-22 14:49:21 +0100 |
commit | dd04f5a73ccc125be80a3ba3a3ab508ac300b99a (patch) | |
tree | db504bb2f55757a79a4173f7d2b82f9a66d08229 /src/WorldStorage | |
parent | Merge branch 'master' of https://github.com/mc-server/MCServer (diff) | |
download | cuberite-dd04f5a73ccc125be80a3ba3a3ab508ac300b99a.tar cuberite-dd04f5a73ccc125be80a3ba3a3ab508ac300b99a.tar.gz cuberite-dd04f5a73ccc125be80a3ba3a3ab508ac300b99a.tar.bz2 cuberite-dd04f5a73ccc125be80a3ba3a3ab508ac300b99a.tar.lz cuberite-dd04f5a73ccc125be80a3ba3a3ab508ac300b99a.tar.xz cuberite-dd04f5a73ccc125be80a3ba3a3ab508ac300b99a.tar.zst cuberite-dd04f5a73ccc125be80a3ba3a3ab508ac300b99a.zip |
Diffstat (limited to '')
-rw-r--r-- | src/WorldStorage/ScoreboardSerializer.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/WorldStorage/ScoreboardSerializer.cpp b/src/WorldStorage/ScoreboardSerializer.cpp index bcac50bb6..dabc5e2e1 100644 --- a/src/WorldStorage/ScoreboardSerializer.cpp +++ b/src/WorldStorage/ScoreboardSerializer.cpp @@ -22,7 +22,12 @@ cScoreboardSerializer::cScoreboardSerializer(const AString & a_WorldName, cScoreboard* a_ScoreBoard) : m_ScoreBoard(a_ScoreBoard) { - Printf(m_Path, "%s/data/scoreboard.dat", a_WorldName.c_str()); + AString DataPath; + Printf(DataPath, "%s/data", a_WorldName.c_str()); + + m_Path = DataPath + "/scoreboard.dat"; + + cFile::CreateFolder(FILE_IO_PREFIX + DataPath); } @@ -33,7 +38,7 @@ bool cScoreboardSerializer::Load(void) { cFile File; - if (!File.Open(m_Path, cFile::fmReadWrite)) + if (!File.Open(FILE_IO_PREFIX + m_Path, cFile::fmReadWrite)) { return false; } @@ -60,7 +65,7 @@ bool cScoreboardSerializer::Load(void) { return false; } - + // Parse the NBT data: cParsedNBT NBT(Uncompressed, strm.total_out); if (!NBT.IsValid()) @@ -81,7 +86,7 @@ bool cScoreboardSerializer::Save(void) cFastNBTWriter Writer; Writer.BeginCompound(""); - + m_ScoreBoard->RegisterObjective("test","test",cObjective::E_TYPE_DUMMY)->AddScore("dot", 2); SaveScoreboardToNBT(Writer); Writer.EndCompound(); @@ -91,7 +96,7 @@ bool cScoreboardSerializer::Save(void) cParsedNBT TestParse(Writer.GetResult().data(), Writer.GetResult().size()); ASSERT(TestParse.IsValid()); #endif // _DEBUG - + gzFile gz = gzopen((FILE_IO_PREFIX + m_Path).c_str(), "wb"); if (gz != NULL) { |