From c13b1931ff26a5643c9fe68ab32b1e362cfacd70 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 9 May 2015 09:25:09 +0200 Subject: More style checking. Spaces around some operators are checked. --- src/WorldStorage/FastNBT.h | 2 +- src/WorldStorage/MapSerializer.cpp | 8 ++++---- src/WorldStorage/ScoreboardSerializer.cpp | 2 +- src/WorldStorage/StatSerializer.cpp | 2 +- src/WorldStorage/WSSAnvil.cpp | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/WorldStorage') diff --git a/src/WorldStorage/FastNBT.h b/src/WorldStorage/FastNBT.h index c6225eacf..35e47c8e4 100644 --- a/src/WorldStorage/FastNBT.h +++ b/src/WorldStorage/FastNBT.h @@ -164,7 +164,7 @@ public: /** Returns the direct child tag of the specified name, or -1 if no such tag. */ int FindChildByName(int a_Tag, const char * a_Name, size_t a_NameLength = 0) const; - /** Returns the child tag of the specified path (Name1/Name2/Name3...), or -1 if no such tag. */ + /** Returns the child tag of the specified path (Name1 / Name2 / Name3...), or -1 if no such tag. */ int FindTagByPath(int a_Tag, const AString & a_Path) const; eTagType GetType(int a_Tag) const { return m_Tags[(size_t)a_Tag].m_Type; } diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp index f2d35b318..6f0449041 100644 --- a/src/WorldStorage/MapSerializer.cpp +++ b/src/WorldStorage/MapSerializer.cpp @@ -19,9 +19,9 @@ cMapSerializer::cMapSerializer(const AString& a_WorldName, cMap * a_Map) : m_Map(a_Map) { AString DataPath; - Printf(DataPath, "%s/data", a_WorldName.c_str()); + Printf(DataPath, "%s%cdata", a_WorldName.c_str(), cFile::PathSeparator); - Printf(m_Path, "%s/map_%i.dat", DataPath.c_str(), a_Map->GetID()); + Printf(m_Path, "%s%cmap_%i.dat", DataPath.c_str(), cFile::PathSeparator, a_Map->GetID()); cFile::CreateFolder(FILE_IO_PREFIX + DataPath); } @@ -203,9 +203,9 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT) cIDCountSerializer::cIDCountSerializer(const AString & a_WorldName) : m_MapCount(0) { AString DataPath; - Printf(DataPath, "%s/data", a_WorldName.c_str()); + Printf(DataPath, "%s%cdata", a_WorldName.c_str(), cFile::PathSeparator); - Printf(m_Path, "%s/idcounts.dat", DataPath.c_str()); + Printf(m_Path, "%s%cidcounts.dat", DataPath.c_str(), cFile::PathSeparator); cFile::CreateFolder(FILE_IO_PREFIX + DataPath); } diff --git a/src/WorldStorage/ScoreboardSerializer.cpp b/src/WorldStorage/ScoreboardSerializer.cpp index 404604382..0d8730e49 100644 --- a/src/WorldStorage/ScoreboardSerializer.cpp +++ b/src/WorldStorage/ScoreboardSerializer.cpp @@ -18,7 +18,7 @@ cScoreboardSerializer::cScoreboardSerializer(const AString & a_WorldName, cScore : m_ScoreBoard(a_ScoreBoard) { AString DataPath; - Printf(DataPath, "%s/data", a_WorldName.c_str()); + Printf(DataPath, "%s%cdata", a_WorldName.c_str(), cFile::PathSeparator); m_Path = DataPath + "/scoreboard.dat"; diff --git a/src/WorldStorage/StatSerializer.cpp b/src/WorldStorage/StatSerializer.cpp index 74113941c..99a702c39 100644 --- a/src/WorldStorage/StatSerializer.cpp +++ b/src/WorldStorage/StatSerializer.cpp @@ -18,7 +18,7 @@ cStatSerializer::cStatSerializer(const AString & a_WorldName, const AString & a_ // inside the folder of the default world. AString StatsPath; - Printf(StatsPath, "%s/stats", a_WorldName.c_str()); + Printf(StatsPath, "%s%cstats", a_WorldName.c_str(), cFile::PathSeparator); m_Path = StatsPath + "/" + a_PlayerName + ".json"; diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 948a0c9a0..f389e7cbf 100755 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -95,7 +95,7 @@ cWSSAnvil::cWSSAnvil(cWorld * a_World, int a_CompressionFactor) : { // Create a level.dat file for mapping tools, if it doesn't already exist: AString fnam; - Printf(fnam, "%s/level.dat", a_World->GetName().c_str()); + Printf(fnam, "%s%clevel.dat", a_World->GetName().c_str(), cFile::PathSeparator); if (!cFile::Exists(fnam)) { cFastNBTWriter Writer; @@ -251,7 +251,7 @@ cWSSAnvil::cMCAFile * cWSSAnvil::LoadMCAFile(const cChunkCoords & a_Chunk) // Load it anew: AString FileName; - Printf(FileName, "%s/region", m_World->GetName().c_str()); + Printf(FileName, "%s%cregion", m_World->GetName().c_str(), cFile::PathSeparator); cFile::CreateFolder(FILE_IO_PREFIX + FileName); AppendPrintf(FileName, "/r.%d.%d.mca", RegionX, RegionZ); cMCAFile * f = new cMCAFile(FileName, RegionX, RegionZ); @@ -323,7 +323,7 @@ bool cWSSAnvil::SaveChunkToData(const cChunkCoords & a_Chunk, AString & a_Data) bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, const cParsedNBT & a_NBT) { - // The data arrays, in MCA-native y/z/x ordering (will be reordered for the final chunk data) + // The data arrays, in MCA-native y / z / x ordering (will be reordered for the final chunk data) cChunkDef::BlockTypes BlockTypes; cChunkDef::BlockNibbles MetaData; cChunkDef::BlockNibbles BlockLight; @@ -879,7 +879,7 @@ cBlockEntity * cWSSAnvil::LoadBeaconFromNBT(const cParsedNBT & a_NBT, int a_TagI Beacon->SetSecondaryEffect((cEntityEffect::eType)a_NBT.GetInt(CurrentLine)); } - // We are better than mojang, we load/save the beacon inventory! + // We are better than mojang, we load / save the beacon inventory! int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); if ((Items >= 0) && (a_NBT.GetType(Items) == TAG_List)) { -- cgit v1.2.3 From 846d16315a8b5a81fbc37d66da4d1254038ec494 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 9 May 2015 11:16:56 +0200 Subject: CheckBasicStyle: checks spaces around * and &. --- src/WorldStorage/EnchantmentSerializer.cpp | 4 ++-- src/WorldStorage/EnchantmentSerializer.h | 4 ++-- src/WorldStorage/MapSerializer.cpp | 4 ++-- src/WorldStorage/MapSerializer.h | 2 +- src/WorldStorage/ScoreboardSerializer.cpp | 6 +++--- src/WorldStorage/ScoreboardSerializer.h | 4 ++-- src/WorldStorage/StatSerializer.h | 2 +- src/WorldStorage/WSSAnvil.cpp | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/WorldStorage') diff --git a/src/WorldStorage/EnchantmentSerializer.cpp b/src/WorldStorage/EnchantmentSerializer.cpp index 56072207f..a6e562956 100644 --- a/src/WorldStorage/EnchantmentSerializer.cpp +++ b/src/WorldStorage/EnchantmentSerializer.cpp @@ -5,7 +5,7 @@ #include "Enchantments.h" #include "FastNBT.h" -void EnchantmentSerializer::WriteToNBTCompound(cEnchantments const& a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName) +void EnchantmentSerializer::WriteToNBTCompound(const cEnchantments & a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName) { // Write the enchantments into the specified NBT writer // begin with the LIST tag of the specified name ("ench" or "StoredEnchantments") @@ -25,7 +25,7 @@ void EnchantmentSerializer::WriteToNBTCompound(cEnchantments const& a_Enchantmen -void EnchantmentSerializer::ParseFromNBT(cEnchantments& a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx) +void EnchantmentSerializer::ParseFromNBT(cEnchantments & a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx) { // Read the enchantments from the specified NBT list tag (ench or StoredEnchantments) diff --git a/src/WorldStorage/EnchantmentSerializer.h b/src/WorldStorage/EnchantmentSerializer.h index 9ed362900..7d6546aad 100644 --- a/src/WorldStorage/EnchantmentSerializer.h +++ b/src/WorldStorage/EnchantmentSerializer.h @@ -9,9 +9,9 @@ namespace EnchantmentSerializer { /// Writes the enchantments into the specified NBT writer; begins with the LIST tag of the specified name ("ench" or "StoredEnchantments") - void WriteToNBTCompound(cEnchantments const& a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName); + void WriteToNBTCompound(const cEnchantments & a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName); /// Reads the enchantments from the specified NBT list tag (ench or StoredEnchantments) - void ParseFromNBT(cEnchantments& a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx); + void ParseFromNBT(cEnchantments & a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx); }; diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp index 6f0449041..da7b9d929 100644 --- a/src/WorldStorage/MapSerializer.cpp +++ b/src/WorldStorage/MapSerializer.cpp @@ -15,8 +15,8 @@ -cMapSerializer::cMapSerializer(const AString& a_WorldName, cMap * a_Map) - : m_Map(a_Map) +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); diff --git a/src/WorldStorage/MapSerializer.h b/src/WorldStorage/MapSerializer.h index e13a75c8f..007f1347b 100644 --- a/src/WorldStorage/MapSerializer.h +++ b/src/WorldStorage/MapSerializer.h @@ -26,7 +26,7 @@ class cMapSerializer { public: - cMapSerializer(const AString& a_WorldName, cMap * a_Map); + cMapSerializer(const AString & a_WorldName, cMap * a_Map); /** Try to load the map */ bool Load(void); diff --git a/src/WorldStorage/ScoreboardSerializer.cpp b/src/WorldStorage/ScoreboardSerializer.cpp index 0d8730e49..01e56dbe1 100644 --- a/src/WorldStorage/ScoreboardSerializer.cpp +++ b/src/WorldStorage/ScoreboardSerializer.cpp @@ -14,13 +14,13 @@ -cScoreboardSerializer::cScoreboardSerializer(const AString & a_WorldName, cScoreboard* a_ScoreBoard) - : m_ScoreBoard(a_ScoreBoard) +cScoreboardSerializer::cScoreboardSerializer(const AString & a_WorldName, cScoreboard * a_ScoreBoard): + m_ScoreBoard(a_ScoreBoard) { AString DataPath; Printf(DataPath, "%s%cdata", a_WorldName.c_str(), cFile::PathSeparator); - m_Path = DataPath + "/scoreboard.dat"; + m_Path = DataPath + cFile::PathSeparator + "scoreboard.dat"; cFile::CreateFolder(FILE_IO_PREFIX + DataPath); } diff --git a/src/WorldStorage/ScoreboardSerializer.h b/src/WorldStorage/ScoreboardSerializer.h index 048fa3ab4..f9065b35f 100644 --- a/src/WorldStorage/ScoreboardSerializer.h +++ b/src/WorldStorage/ScoreboardSerializer.h @@ -25,7 +25,7 @@ class cScoreboardSerializer { public: - cScoreboardSerializer(const AString & a_WorldName, cScoreboard* a_ScoreBoard); + cScoreboardSerializer(const AString & a_WorldName, cScoreboard * a_ScoreBoard); /// Try to load the scoreboard bool Load(void); @@ -40,7 +40,7 @@ private: bool LoadScoreboardFromNBT(const cParsedNBT & a_NBT); - cScoreboard* m_ScoreBoard; + cScoreboard * m_ScoreBoard; AString m_Path; diff --git a/src/WorldStorage/StatSerializer.h b/src/WorldStorage/StatSerializer.h index 72f8d74f1..6b7efddbb 100644 --- a/src/WorldStorage/StatSerializer.h +++ b/src/WorldStorage/StatSerializer.h @@ -43,7 +43,7 @@ protected: private: - cStatManager* m_Manager; + cStatManager * m_Manager; AString m_Path; diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index f389e7cbf..392b9bf83 100755 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -3148,7 +3148,7 @@ bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AStri } // Store the header: - ChunkSize = ((u_long)a_Data.size() + MCA_CHUNK_HEADER_LENGTH + 4095) / 4096; // Round data size *up* to nearest 4KB sector, make it a sector number + ChunkSize = ((u_long)a_Data.size() + MCA_CHUNK_HEADER_LENGTH + 4095) / 4096; // Round data size up to nearest 4KB sector, make it a sector number if (ChunkSize > 255) { LOGWARNING("Cannot save chunk [%d, %d], the data is too large (%u KiB, maximum is 1024 KiB). Remove some entities and retry.", -- cgit v1.2.3