diff options
author | Mattes D <github@xoft.cz> | 2023-05-11 22:05:17 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2023-05-16 23:50:37 +0200 |
commit | c9522fb740200ccef6230cec452c48efb31e5394 (patch) | |
tree | 7e74d70699e13dd0a92444a1a0add7a3059ac7ca /src/WorldStorage/MapSerializer.cpp | |
parent | Try a timeout for jobs. (diff) | |
download | cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.gz cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.bz2 cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.lz cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.xz cuberite-c9522fb740200ccef6230cec452c48efb31e5394.tar.zst cuberite-c9522fb740200ccef6230cec452c48efb31e5394.zip |
Diffstat (limited to 'src/WorldStorage/MapSerializer.cpp')
-rw-r--r-- | src/WorldStorage/MapSerializer.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp index 7e67d8059..e68ad00e6 100644 --- a/src/WorldStorage/MapSerializer.cpp +++ b/src/WorldStorage/MapSerializer.cpp @@ -17,11 +17,8 @@ cMapSerializer::cMapSerializer(const AString & a_WorldName, cMap * a_Map): m_Map(a_Map) { - AString DataPath; - Printf(DataPath, "%s%cdata", a_WorldName.c_str(), cFile::PathSeparator()); - - Printf(m_Path, "%s%cmap_%i.dat", DataPath.c_str(), cFile::PathSeparator(), a_Map->GetID()); - + auto DataPath = fmt::format(FMT_STRING("{}{}data"), a_WorldName, cFile::PathSeparator()); + m_Path = fmt::format(FMT_STRING("{}{}map_%i.dat"), DataPath, cFile::PathSeparator(), a_Map->GetID()); cFile::CreateFolder(DataPath); } @@ -29,7 +26,7 @@ cMapSerializer::cMapSerializer(const AString & a_WorldName, cMap * a_Map): -bool cMapSerializer::Load(void) +bool cMapSerializer::Load() { const auto Data = GZipFile::ReadRestOfFile(m_Path); const cParsedNBT NBT(Data.GetView()); @@ -171,11 +168,8 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT) cIDCountSerializer::cIDCountSerializer(const AString & a_WorldName) : m_MapCount(0) { - AString DataPath; - Printf(DataPath, "%s%cdata", a_WorldName.c_str(), cFile::PathSeparator()); - - Printf(m_Path, "%s%cidcounts.dat", DataPath.c_str(), cFile::PathSeparator()); - + auto DataPath = fmt::format(FMT_STRING("{}{}data"), a_WorldName, cFile::PathSeparator()); + m_Path = fmt::format(FMT_STRING("{}{}idcounts.dat"), DataPath, cFile::PathSeparator()); cFile::CreateFolder(DataPath); } @@ -183,7 +177,7 @@ cIDCountSerializer::cIDCountSerializer(const AString & a_WorldName) : m_MapCount -bool cIDCountSerializer::Load(void) +bool cIDCountSerializer::Load() { AString Data = cFile::ReadWholeFile(m_Path); if (Data.empty()) |