From 63af47832d37de7829bb2dbfe2df9b63045cf556 Mon Sep 17 00:00:00 2001 From: Tri125 Date: Wed, 6 May 2015 23:12:17 -0400 Subject: Fixed the sound issue with the MagmaCube -Name of the sound is correctly capitalized -Get the appropriate sound depending on its size --- src/Mobs/MagmaCube.cpp | 14 ++++++++++++-- src/Mobs/MagmaCube.h | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Mobs/MagmaCube.cpp b/src/Mobs/MagmaCube.cpp index 3e9abc108..e56cfa4b8 100644 --- a/src/Mobs/MagmaCube.cpp +++ b/src/Mobs/MagmaCube.cpp @@ -7,7 +7,7 @@ cMagmaCube::cMagmaCube(int a_Size) : - super("MagmaCube", mtMagmaCube, "mob.MagmaCube.big", "mob.MagmaCube.big", 0.6 * a_Size, 0.6 * a_Size), + super("MagmaCube", mtMagmaCube, Printf("mob.magmacube.%s", GetSizeName(a_Size).c_str()), Printf("mob.magmacube.%s", GetSizeName(a_Size).c_str()), 0.6 * a_Size, 0.6 * a_Size), m_Size(a_Size) { } @@ -27,4 +27,14 @@ void cMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer) - +const AString cMagmaCube::GetSizeName(int a_Size) const +{ + if (a_Size > 1) + { + return "big"; + } + else + { + return "small"; + } +} diff --git a/src/Mobs/MagmaCube.h b/src/Mobs/MagmaCube.h index d66ea423a..62dd83944 100644 --- a/src/Mobs/MagmaCube.h +++ b/src/Mobs/MagmaCube.h @@ -19,6 +19,10 @@ public: virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override; int GetSize(void) const { return m_Size; } + + /** Returns the text describing the slime's size, as used by the client's resource subsystem for sounds. + Returns either "big" or "small". */ + const AString GetSizeName(int a_Size) const; protected: -- cgit v1.2.3 From 9f6192687f84fc97c5f854c778f3b393965794ef Mon Sep 17 00:00:00 2001 From: Tri125 Date: Wed, 6 May 2015 23:29:36 -0400 Subject: Big Magma Cube can now spawn Following the same method as the Slime, Magma Cube can now spawn with the size of 1, 2 or 4. --- src/Mobs/MagmaCube.h | 2 +- src/Mobs/Monster.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Mobs/MagmaCube.h b/src/Mobs/MagmaCube.h index 62dd83944..d4b3997da 100644 --- a/src/Mobs/MagmaCube.h +++ b/src/Mobs/MagmaCube.h @@ -26,7 +26,7 @@ public: protected: - /// Size of the MagmaCube, 1 .. 3, with 1 being the smallest + /// Size of the MagmaCube, 1, 2 and 4, with 1 being the smallest int m_Size; } ; diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 37774b08f..e86570c77 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -886,7 +886,7 @@ cMonster * cMonster::NewMonsterFromType(eMonsterType a_MobType) { case mtMagmaCube: { - toReturn = new cMagmaCube(Random.NextInt(2) + 1); + toReturn = new cMagmaCube(1 << Random.NextInt(3)); // Size 1, 2 or 4 break; } case mtSlime: -- cgit v1.2.3 From 429e5451670f27d4d2563711370a65d86f282119 Mon Sep 17 00:00:00 2001 From: Tri125 Date: Thu, 7 May 2015 11:39:47 -0400 Subject: Fixed #1893 Quartz ore now stack properly --- src/Items/ItemHandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index dddd67cdd..6bcb5f27a 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -579,6 +579,7 @@ char cItemHandler::GetMaxStackSize(void) case E_ITEM_MELON_SEEDS: return 64; case E_ITEM_MELON_SLICE: return 64; case E_ITEM_NETHER_BRICK: return 64; + case E_ITEM_NETHER_QUARTZ: return 64; case E_ITEM_NETHER_WART: return 64; case E_ITEM_PAINTING: return 64; case E_ITEM_PAPER: return 64; -- cgit v1.2.3 From 60f150e77d933e7af99ff48d93fa1cfbad973449 Mon Sep 17 00:00:00 2001 From: Safwat Halaby Date: Fri, 8 May 2015 19:59:14 +0300 Subject: Update Contributing.MD Double space is rendering as a single space so I changed the comment line a bit, the new version is clearer anyway. Added an exception to CamelCase (single letter vars) --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 82f09b6bf..4e57e6efb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,8 +8,8 @@ Here are the conventions: * We use the subset of C++11 supported by MSVC 2013 (ask if you think that something would be useful) * All new public functions in all classes need documenting comments on what they do and what behavior they follow, use doxy-comments formatted as `/** Description */`. Do not use asterisks on additional lines in multi-line comments. * Use spaces after the comment markers: `// Comment` instead of `//Comment`. A comment must be prefixed with two spaces if it's on the same line with code: - - `SomeFunction() // Note the two spaces prefixed to me and the space after the slashes.` - * All variable names and function names use CamelCase style. + - `SomeFunction()//Note the two spaces prefixed to me and the space after the slashes.` + * All variable names and function names use CamelCase style, with the exception of single letter variables. - `ThisIsAProperFunction()` `This_is_bad()` `this_is_bad` `GoodVariableName` `badVariableName`. * All member variables start with `m_`, all function parameters start with `a_`, all class names start with `c`. - `class cMonster { int m_Health; int DecreaseHealth(int a_Amount); }` -- cgit v1.2.3 From 1cef39cb73f5a9130d2cb9d497ca44350fb401d8 Mon Sep 17 00:00:00 2001 From: worktycho Date: Fri, 8 May 2015 23:20:22 +0100 Subject: Move chunk position accesses after the chunk validity checks --- src/Mobs/Monster.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 84f58ff85..9df5bd930 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -264,12 +264,14 @@ bool cMonster::EnsureProperDestination(cChunk & a_Chunk) cChunk * Chunk = a_Chunk.GetNeighborChunk(m_FinalDestination.x, m_FinalDestination.z); BLOCKTYPE BlockType; NIBBLETYPE BlockMeta; - int RelX = m_FinalDestination.x - Chunk->GetPosX() * cChunkDef::Width; - int RelZ = m_FinalDestination.z - Chunk->GetPosZ() * cChunkDef::Width; + if ((Chunk == nullptr) || !Chunk->IsValid()) { return false; } + + int RelX = m_FinalDestination.x - Chunk->GetPosX() * cChunkDef::Width; + int RelZ = m_FinalDestination.z - Chunk->GetPosZ() * cChunkDef::Width; // If destination in the air, go down to the lowest air block. while (m_FinalDestination.y > 0) -- cgit v1.2.3 From eaba777a0e268cb883cabb3259989a1d2d9911f0 Mon Sep 17 00:00:00 2001 From: Woazboat Date: Sat, 9 May 2015 01:15:45 +0200 Subject: Fixed compiler warning overrides in Vector3.h --- src/Vector3.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Vector3.h b/src/Vector3.h index f116c07f6..355ba6a52 100644 --- a/src/Vector3.h +++ b/src/Vector3.h @@ -80,14 +80,14 @@ public: inline bool HasNonZeroLength(void) const { - #ifndef __GNUC__ + #ifdef __clang__ #pragma clang diagnostics push #pragma clang diagnostics ignored "-Wfloat-equal" #endif return ((x != 0) || (y != 0) || (z != 0)); - #ifndef __GNUC__ + #ifdef __clang__ #pragma clang diagnostics pop #endif } @@ -136,14 +136,14 @@ public: // Perform a strict comparison of the contents - we want to know whether this object is exactly equal // To perform EPS-based comparison, use the EqualsEps() function - #ifndef __GNUC__ + #ifdef __clang__ #pragma clang diagnostics push #pragma clang diagnostics ignored "-Wfloat-equal" #endif return !((x != a_Rhs.x) || (y != a_Rhs.y) || (z != a_Rhs.z)); - #ifndef __GNUC__ + #ifdef __clang__ #pragma clang diagnostics pop #endif } -- cgit v1.2.3 From 4642a50d627e5946079068c8aa19aa1e2b27846e Mon Sep 17 00:00:00 2001 From: Tristan Date: Fri, 8 May 2015 20:50:05 -0400 Subject: GetSizeName of cSlime and cMagmaCube is now static --- src/Mobs/MagmaCube.cpp | 2 +- src/Mobs/MagmaCube.h | 2 +- src/Mobs/Slime.cpp | 2 +- src/Mobs/Slime.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mobs/MagmaCube.cpp b/src/Mobs/MagmaCube.cpp index e56cfa4b8..c5dd0def0 100644 --- a/src/Mobs/MagmaCube.cpp +++ b/src/Mobs/MagmaCube.cpp @@ -27,7 +27,7 @@ void cMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer) -const AString cMagmaCube::GetSizeName(int a_Size) const +AString cMagmaCube::GetSizeName(int a_Size) { if (a_Size > 1) { diff --git a/src/Mobs/MagmaCube.h b/src/Mobs/MagmaCube.h index d4b3997da..b914dc867 100644 --- a/src/Mobs/MagmaCube.h +++ b/src/Mobs/MagmaCube.h @@ -22,7 +22,7 @@ public: /** Returns the text describing the slime's size, as used by the client's resource subsystem for sounds. Returns either "big" or "small". */ - const AString GetSizeName(int a_Size) const; + static AString GetSizeName(int a_Size); protected: diff --git a/src/Mobs/Slime.cpp b/src/Mobs/Slime.cpp index e42501e47..7fc4821d8 100644 --- a/src/Mobs/Slime.cpp +++ b/src/Mobs/Slime.cpp @@ -89,7 +89,7 @@ void cSlime::KilledBy(TakeDamageInfo & a_TDI) -const AString cSlime::GetSizeName(int a_Size) const +AString cSlime::GetSizeName(int a_Size) { if (a_Size > 1) { diff --git a/src/Mobs/Slime.h b/src/Mobs/Slime.h index 29605992d..40131b101 100644 --- a/src/Mobs/Slime.h +++ b/src/Mobs/Slime.h @@ -27,7 +27,7 @@ public: /** Returns the text describing the slime's size, as used by the client's resource subsystem for sounds. Returns either "big" or "small". */ - const AString GetSizeName(int a_Size) const; + static AString GetSizeName(int a_Size); protected: -- cgit v1.2.3 From 4dcd9a99245e6059d3f16723d1353efaa495ca08 Mon Sep 17 00:00:00 2001 From: worktycho Date: Sat, 9 May 2015 10:55:40 +0100 Subject: clang diagnostic not diagnostics fixed clang pragmas --- src/Vector3.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Vector3.h b/src/Vector3.h index ed3f296a6..84e9183be 100644 --- a/src/Vector3.h +++ b/src/Vector3.h @@ -81,14 +81,14 @@ public: inline bool HasNonZeroLength(void) const { #ifdef __clang__ - #pragma clang diagnostics push - #pragma clang diagnostics ignored "-Wfloat-equal" + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wfloat-equal" #endif return ((x != 0) || (y != 0) || (z != 0)); #ifdef __clang__ - #pragma clang diagnostics pop + #pragma clang diagnostic pop #endif } -- cgit v1.2.3 From e2e206d81bad6c8624fb81ef46a6c81a69792f15 Mon Sep 17 00:00:00 2001 From: worktycho Date: Sat, 9 May 2015 10:59:08 +0100 Subject: Fixed remaing pragmas --- src/Vector3.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Vector3.h b/src/Vector3.h index 84e9183be..f051ce2d2 100644 --- a/src/Vector3.h +++ b/src/Vector3.h @@ -137,14 +137,14 @@ public: // To perform EPS-based comparison, use the EqualsEps() function #ifdef __clang__ - #pragma clang diagnostics push - #pragma clang diagnostics ignored "-Wfloat-equal" + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wfloat-equal" #endif return !((x != a_Rhs.x) || (y != a_Rhs.y) || (z != a_Rhs.z)); #ifdef __clang__ - #pragma clang diagnostics pop + #pragma clang diagnostic pop #endif } -- cgit v1.2.3 From 61300ab9ef8b9eb16b0d334b1d406d429b7ea0c7 Mon Sep 17 00:00:00 2001 From: jammet Date: Sat, 9 May 2015 12:35:23 +0200 Subject: Rabbit and cooked rabbit now stackable And corrected the alphabetical ordering. --- src/Items/ItemHandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index 6bcb5f27a..7328456b4 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -543,8 +543,9 @@ char cItemHandler::GetMaxStackSize(void) case E_ITEM_COMPASS: return 64; case E_ITEM_COOKED_CHICKEN: return 64; case E_ITEM_COOKED_FISH: return 64; - case E_ITEM_COOKED_PORKCHOP: return 64; case E_ITEM_COOKED_MUTTON: return 64; + case E_ITEM_COOKED_PORKCHOP: return 64; + case E_ITEM_COOKED_RABBIT: return 64; case E_ITEM_COOKIE: return 64; case E_ITEM_DARK_OAK_DOOR: return 64; case E_ITEM_DIAMOND: return 64; @@ -596,6 +597,7 @@ char cItemHandler::GetMaxStackSize(void) case E_ITEM_RAW_FISH: return 64; case E_ITEM_RAW_MUTTON: return 64; case E_ITEM_RAW_PORKCHOP: return 64; + case E_ITEM_RAW_RABBIT: return 64; case E_ITEM_RED_APPLE: return 64; case E_ITEM_REDSTONE_DUST: return 64; case E_ITEM_REDSTONE_REPEATER: return 64; -- cgit v1.2.3 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/Bindings/LuaState.cpp | 4 +- src/Bindings/PluginLua.h | 2 +- src/BlockEntities/MobHeadEntity.cpp | 2 +- src/BlockEntities/MobHeadEntity.h | 2 +- src/Blocks/BlockComparator.h | 2 +- src/Blocks/BlockDoor.cpp | 6 +-- src/Blocks/BlockFire.h | 6 +-- src/Blocks/BlockLever.h | 2 +- src/Blocks/BlockPiston.h | 2 +- src/Blocks/BlockRail.h | 16 +++---- src/Blocks/BlockTrapdoor.h | 2 +- src/BoundingBox.h | 4 +- src/CheckBasicStyle.lua | 21 ++++++++++ src/Chunk.cpp | 6 +-- src/ClientHandle.cpp | 12 +++--- src/ClientHandle.h | 4 +- src/Defines.h | 2 +- src/Enchantments.h | 2 +- src/Entities/Entity.cpp | 7 ++-- src/Entities/Entity.h | 4 +- src/Entities/EntityEffect.cpp | 4 +- src/Entities/Minecart.cpp | 4 +- src/Entities/Minecart.h | 5 +-- src/Entities/Player.cpp | 12 +++--- src/Entities/Player.h | 2 +- src/Entities/ProjectileEntity.h | 2 +- src/Generating/Caves.cpp | 4 +- src/Generating/ChunkGenerator.cpp | 4 +- src/Generating/FinishGen.cpp | 2 +- src/Generating/HeiGen.cpp | 2 +- src/Generating/IntGen.h | 4 +- src/Generating/Noise3DGenerator.cpp | 2 +- src/Generating/ProtIntGen.h | 2 +- src/Generating/RainbowRoadsGen.cpp | 2 +- src/Generating/RainbowRoadsGen.h | 2 +- src/Generating/Ravines.cpp | 4 +- src/Generating/StructGen.cpp | 2 +- src/Generating/TestRailsGen.cpp | 2 +- src/Generating/TestRailsGen.h | 4 +- src/Generating/Trees.cpp | 4 +- src/Generating/UnderwaterBaseGen.cpp | 2 +- src/Generating/UnderwaterBaseGen.h | 2 +- src/Generating/VillageGen.cpp | 2 +- src/Generating/VillageGen.h | 2 +- src/Globals.h | 4 +- src/HTTPServer/EnvelopeParser.h | 2 +- src/HTTPServer/HTTPMessage.cpp | 2 +- src/IniFile.cpp | 4 +- src/IniFile.h | 10 ++--- src/Items/ItemLighter.h | 2 +- src/Items/ItemLilypad.h | 2 +- src/Map.h | 2 +- src/MobCensus.cpp | 4 +- src/Mobs/Monster.h | 2 +- src/Mobs/Path.h | 2 +- src/Noise/Noise.cpp | 58 +++++++++++++------------- src/OSSupport/CriticalSection.h | 2 +- src/OSSupport/File.h | 2 +- src/OSSupport/Network.h | 2 +- src/Protocol/MojangAPI.cpp | 4 +- src/Protocol/Protocol17x.cpp | 4 +- src/Protocol/Protocol18x.cpp | 4 +- src/RankManager.cpp | 2 +- src/Simulator/FloodyFluidSimulator.h | 2 +- src/Simulator/IncrementalRedstoneSimulator.cpp | 10 ++--- src/UI/DropSpenserWindow.cpp | 2 +- src/UI/DropSpenserWindow.h | 2 +- src/UI/FurnaceWindow.cpp | 2 +- src/UI/SlotArea.h | 2 +- src/VoronoiMap.h | 2 +- src/World.cpp | 4 +- src/World.h | 6 +-- 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 ++-- src/XMLParser.h | 40 +++++++++--------- 78 files changed, 207 insertions(+), 186 deletions(-) diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index 9c1e2865c..28bf87091 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -19,13 +19,13 @@ extern "C" #include "../Entities/Entity.h" #include "../BlockEntities/BlockEntity.h" -// fwd: SQLite/lsqlite3.c +// fwd: "SQLite/lsqlite3.c" extern "C" { int luaopen_lsqlite3(lua_State * L); } -// fwd: LuaExpat/lxplib.c: +// fwd: "LuaExpat/lxplib.c": extern "C" { int luaopen_lxp(lua_State * L); diff --git a/src/Bindings/PluginLua.h b/src/Bindings/PluginLua.h index 393737b34..bedb3d83b 100644 --- a/src/Bindings/PluginLua.h +++ b/src/Bindings/PluginLua.h @@ -20,7 +20,7 @@ -// fwd: UI/Window.h +// fwd: "UI/Window.h" class cWindow; diff --git a/src/BlockEntities/MobHeadEntity.cpp b/src/BlockEntities/MobHeadEntity.cpp index 67e13ffb2..328ade23a 100644 --- a/src/BlockEntities/MobHeadEntity.cpp +++ b/src/BlockEntities/MobHeadEntity.cpp @@ -1,7 +1,7 @@ // MobHeadEntity.cpp -// Implements the cMobHeadEntity class representing a single skull/head in the world +// Implements the cMobHeadEntity class representing a single skull / head in the world #include "Globals.h" #include "MobHeadEntity.h" diff --git a/src/BlockEntities/MobHeadEntity.h b/src/BlockEntities/MobHeadEntity.h index 7f08c5ab2..b6760b40a 100644 --- a/src/BlockEntities/MobHeadEntity.h +++ b/src/BlockEntities/MobHeadEntity.h @@ -1,6 +1,6 @@ // MobHeadEntity.h -// Declares the cMobHeadEntity class representing a single skull/head in the world +// Declares the cMobHeadEntity class representing a single skull / head in the world diff --git a/src/Blocks/BlockComparator.h b/src/Blocks/BlockComparator.h index 3443fc69e..ed73a162e 100644 --- a/src/Blocks/BlockComparator.h +++ b/src/Blocks/BlockComparator.h @@ -22,7 +22,7 @@ public: virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - Meta ^= 0x04; // Toggle 3rd (addition/subtraction) bit with XOR + Meta ^= 0x04; // Toggle 3rd (addition / subtraction) bit with XOR a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); } diff --git a/src/Blocks/BlockDoor.cpp b/src/Blocks/BlockDoor.cpp index d2bf180be..d13c8d657 100644 --- a/src/Blocks/BlockDoor.cpp +++ b/src/Blocks/BlockDoor.cpp @@ -134,7 +134,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta) return a_Meta; } - // Holds open/closed meta data. 0x0C == 1100. + // Holds open / closed meta data. 0x0C == 1100. NIBBLETYPE OtherMeta = a_Meta & 0x0C; // Mirrors according to a table. 0x03 == 0011. @@ -152,7 +152,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta) NIBBLETYPE cBlockDoorHandler::MetaMirrorYZ(NIBBLETYPE a_Meta) { - // Top bit (0x08) contains door panel type (Top/Bottom panel) Only Bottom panels contain position data + // Top bit (0x08) contains door panel type (Top / Bottom panel) Only Bottom panels contain position data // Return a_Meta if panel is a top panel (0x08 bit is set to 1) // Note: Currently, you can not properly mirror the hinges on a double door. The orientation of the door is stored @@ -165,7 +165,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorYZ(NIBBLETYPE a_Meta) return a_Meta; } - // Holds open/closed meta data. 0x0C == 1100. + // Holds open / closed meta data. 0x0C == 1100. NIBBLETYPE OtherMeta = a_Meta & 0x0C; // Mirrors according to a table. 0x03 == 0011. diff --git a/src/Blocks/BlockFire.h b/src/Blocks/BlockFire.h index bafd385ab..2038df94b 100644 --- a/src/Blocks/BlockFire.h +++ b/src/Blocks/BlockFire.h @@ -106,7 +106,7 @@ public: void FindAndSetPortalFrame(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface) { int MaxY = FindObsidianCeiling(X, Y, Z, a_ChunkInterface); // Get topmost obsidian block as reference for all other checks - int X1 = X + 1, Z1 = Z + 1, X2 = X - 1, Z2 = Z - 1; // Duplicate XZ values, add/subtract one as we've checked the original already the line above + int X1 = X + 1, Z1 = Z + 1, X2 = X - 1, Z2 = Z - 1; // Duplicate XZ values, add / subtract one as we've checked the original already the line above if (MaxY == 0) // Oh noes! Not a portal coordinate :( { @@ -139,7 +139,7 @@ public: return; } - /** Evaluates if coordinates are a portal going XP/XM; returns true if so, and writes boundaries to variable + /** Evaluates if coordinates are a portal going XP / XM; returns true if so, and writes boundaries to variable Takes coordinates of base block and Y coord of target obsidian ceiling */ bool FindPortalSliceX(int X1, int X2, int Y, int Z, int MaxY, cChunkInterface & a_ChunkInterface) { @@ -179,7 +179,7 @@ public: return (FoundFrameXP && FoundFrameXM); } - /// Evaluates if coords are a portal going ZP/ZM; returns true if so, and writes boundaries to variable + /// Evaluates if coords are a portal going ZP / ZM; returns true if so, and writes boundaries to variable bool FindPortalSliceZ(int X, int Y, int Z1, int Z2, int MaxY, cChunkInterface & a_ChunkInterface) { Dir = 2; diff --git a/src/Blocks/BlockLever.h b/src/Blocks/BlockLever.h index f5bedea6c..2da138e5f 100644 --- a/src/Blocks/BlockLever.h +++ b/src/Blocks/BlockLever.h @@ -19,7 +19,7 @@ public: virtual void OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override { - // Flip the ON bit on/off using the XOR bitwise operation + // Flip the ON bit on / off using the XOR bitwise operation NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); diff --git a/src/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index 9a891025a..5933d4885 100644 --- a/src/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h @@ -108,7 +108,7 @@ private: case E_BLOCK_ENCHANTMENT_TABLE: case E_BLOCK_END_PORTAL: case E_BLOCK_END_PORTAL_FRAME: - // Notice the lack of an E_BLOCK_ENDER_CHEST here; its because ender chests can totally be pushed/pulled in MCS :) + // Notice the lack of an E_BLOCK_ENDER_CHEST here; its because ender chests can totally be pushed / pulled in MCS :) case E_BLOCK_FURNACE: case E_BLOCK_LIT_FURNACE: case E_BLOCK_INVERTED_DAYLIGHT_SENSOR: diff --git a/src/Blocks/BlockRail.h b/src/Blocks/BlockRail.h index 02fe3aa95..a2e27a351 100644 --- a/src/Blocks/BlockRail.h +++ b/src/Blocks/BlockRail.h @@ -502,11 +502,11 @@ public: // Save powered rail flag. NIBBLETYPE OtherMeta = a_Meta & 0x08; // Rotates according to table; 0x07 == 0111. - // Rails can either be flat (North/South) or Ascending (Asc. East) + // Rails can either be flat (North / South) or Ascending (Asc. East) switch (a_Meta & 0x07) { - case 0x00: return 0x01 + OtherMeta; // North/South -> East/West - case 0x01: return 0x00 + OtherMeta; // East/West -> North/South + case 0x00: return 0x01 + OtherMeta; // North / South -> East / West + case 0x01: return 0x00 + OtherMeta; // East / West -> North / South case 0x02: return 0x04 + OtherMeta; // Asc. East -> Asc. North case 0x04: return 0x03 + OtherMeta; // Asc. North -> Asc. West @@ -538,11 +538,11 @@ public: // Save powered rail flag. NIBBLETYPE OtherMeta = a_Meta & 0x08; // Rotates according to table; 0x07 == 0111. - // Rails can either be flat (North/South) or Ascending (Asc. East) + // Rails can either be flat (North / South) or Ascending (Asc. East) switch (a_Meta & 0x07) { - case 0x00: return 0x01 + OtherMeta; // North/South -> East/West - case 0x01: return 0x00 + OtherMeta; // East/West -> North/South + case 0x00: return 0x01 + OtherMeta; // North / South -> East / West + case 0x01: return 0x00 + OtherMeta; // East / West -> North / South case 0x02: return 0x05 + OtherMeta; // Asc. East -> Asc. South case 0x05: return 0x03 + OtherMeta; // Asc. South -> Asc. West @@ -574,7 +574,7 @@ public: // Save powered rail flag. NIBBLETYPE OtherMeta = a_Meta & 0x08; // Mirrors according to table; 0x07 == 0111. - // Rails can either be flat (North/South) or Ascending (Asc. East) + // Rails can either be flat (North / South) or Ascending (Asc. East) switch (a_Meta & 0x07) { case 0x05: return 0x04 + OtherMeta; // Asc. South -> Asc. North @@ -605,7 +605,7 @@ public: // Save powered rail flag. NIBBLETYPE OtherMeta = a_Meta & 0x08; // Mirrors according to table; 0x07 == 0111. - // Rails can either be flat (North/South) or Ascending (Asc. East) + // Rails can either be flat (North / South) or Ascending (Asc. East) switch (a_Meta & 0x07) { case 0x02: return 0x03 + OtherMeta; // Asc. East -> Asc. West diff --git a/src/Blocks/BlockTrapdoor.h b/src/Blocks/BlockTrapdoor.h index 8c96de0f1..dbb0b5a5b 100644 --- a/src/Blocks/BlockTrapdoor.h +++ b/src/Blocks/BlockTrapdoor.h @@ -35,7 +35,7 @@ public: return; } - // Flip the ON bit on/off using the XOR bitwise operation + // Flip the ON bit on / off using the XOR bitwise operation NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); diff --git a/src/BoundingBox.h b/src/BoundingBox.h index 928e62afa..8ea758ac7 100644 --- a/src/BoundingBox.h +++ b/src/BoundingBox.h @@ -57,10 +57,10 @@ public: /// Returns true if a boundingbox specified by a_Min and a_Max is inside this bounding box bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max); - /// Returns true if the specified point is inside the bounding box specified by its min/max corners + /// Returns true if the specified point is inside the bounding box specified by its min / max corners static bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max, const Vector3d & a_Point); - /// Returns true if the specified point is inside the bounding box specified by its min/max corners + /// Returns true if the specified point is inside the bounding box specified by its min / max corners static bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max, double a_X, double a_Y, double a_Z); /** Returns true if this bounding box is intersected by the line specified by its two points diff --git a/src/CheckBasicStyle.lua b/src/CheckBasicStyle.lua index 8cd454e8f..09e64b954 100755 --- a/src/CheckBasicStyle.lua +++ b/src/CheckBasicStyle.lua @@ -149,6 +149,27 @@ local g_ViolationPatterns = -- No space before a closing parenthesis: {" %)", "Remove the space before \")\""}, + + -- Check spaces around "+": + {"^[a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"}, + {"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"}, + --[[ + -- Cannot check these because of text such as "X+" and "+2" appearing in some comments. + {"^[a-zA-Z0-9]+ %+[a-zA-Z0-9]+", "Add space after +"}, + {"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+ %+[a-zA-Z0-9]+", "Add space after +"}, + {"^[a-zA-Z0-9]+%+ [a-zA-Z0-9]+", "Add space before +"}, + {"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%+ [a-zA-Z0-9]+", "Add space before +"}, + --]] + + -- Cannot check spaces around "-", because the minus is sometimes used as a hyphen between-words + + -- Check spaces around "*": + {"^[a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"}, + {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"}, + + -- Check spaces around "/": + {"^[a-zA-Z0-9]+%/[a-zA-Z0-9]+", "Add space around /"}, + {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%/[a-zA-Z0-9]+", "Add space around /"}, } diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 95dc7708e..bed5aa991 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -737,7 +737,7 @@ void cChunk::ProcessQueuedSetBlocks(void) { if (GetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ) == itr->m_PreviousType) { - // Current world age is bigger than/equal to target world age - delay time reached AND + // Current world age is bigger than / equal to target world age - delay time reached AND // Previous block type was the same as current block type (to prevent duplication) SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); // SetMeta doesn't send to client itr = m_SetBlockQueue.erase(itr); @@ -751,7 +751,7 @@ void cChunk::ProcessQueuedSetBlocks(void) } else { - // Current world age is bigger than/equal to target world age - delay time reached + // Current world age is bigger than / equal to target world age - delay time reached SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); itr = m_SetBlockQueue.erase(itr); LOGD("Successfully set queued block - previous type ignored"); @@ -1026,7 +1026,7 @@ void cChunk::GrowMelonPumpkin(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_Bl case E_BLOCK_FARMLAND: { // DEBUG: This is here to catch FS #349 - melons growing over other crops. - LOG("Growing melon/pumpkin overwriting %s, growing on %s", + LOG("Growing melon / pumpkin overwriting %s, growing on %s", ItemTypeToString(BlockType[CheckType]).c_str(), ItemTypeToString(Soil).c_str() ); diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index b12ab419b..7117229f7 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -436,7 +436,7 @@ bool cClientHandle::StreamNextChunk(void) { Vector3d Vector = Position + LookVector * cChunkDef::Width * Range; - // Get the chunk from the x/z coords. + // Get the chunk from the x / z coords. int RangeX, RangeZ = 0; cChunkDef::BlockToChunk(FloorC(Vector.x), FloorC(Vector.z), RangeX, RangeZ); @@ -454,7 +454,7 @@ bool cClientHandle::StreamNextChunk(void) continue; } - // If the chunk already loading/loaded -> skip + // If the chunk already loading / loaded -> skip if ( (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) || (std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.end()) @@ -492,7 +492,7 @@ bool cClientHandle::StreamNextChunk(void) { cChunkCoords Coords = *itr; - // If the chunk already loading/loaded -> skip + // If the chunk already loading / loaded -> skip if ( (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) || (std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.end()) @@ -1154,7 +1154,7 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc return; } - // Set the last digging coords to the block being dug, so that they can be checked in DIG_FINISHED to avoid dig/aim bug in the client: + // Set the last digging coords to the block being dug, so that they can be checked in DIG_FINISHED to avoid dig / aim bug in the client: m_HasStartedDigging = true; m_LastDigBlockX = a_BlockX; m_LastDigBlockY = a_BlockY; @@ -1201,7 +1201,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo (m_LastDigBlockZ != a_BlockZ) ) { - LOGD("Prevented a dig/aim bug in the client (finish {%d, %d, %d} vs start {%d, %d, %d}, HSD: %s)", + LOGD("Prevented a dig / aim bug in the client (finish {%d, %d, %d} vs start {%d, %d, %d}, HSD: %s)", a_BlockX, a_BlockY, a_BlockZ, m_LastDigBlockX, m_LastDigBlockY, m_LastDigBlockZ, (m_HasStartedDigging ? "True" : "False") @@ -1359,7 +1359,7 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e if (!CheckBlockInteractionsRate()) { - Kick("Too many blocks were placed/interacted with per unit time - hacked client?"); + Kick("Too many blocks were placed / interacted with per unit time - hacked client?"); return; } diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 7992d6bc2..61f29b57c 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -391,7 +391,7 @@ private: cPlayer * m_Player; - bool m_HasSentDC; ///< True if a D/C packet has been sent in either direction + bool m_HasSentDC; ///< True if a Disconnect packet has been sent in either direction // Chunk position when the last StreamChunks() was called; used to avoid re-streaming while in the same chunk int m_LastStreamedChunkX; @@ -416,7 +416,7 @@ private: int m_BlockDigAnimY; int m_BlockDigAnimZ; - // To avoid dig/aim bug in the client, store the last position given in a DIG_START packet and compare to that when processing the DIG_FINISH packet: + // To avoid dig / aim bug in the client, store the last position given in a DIG_START packet and compare to that when processing the DIG_FINISH packet: bool m_HasStartedDigging; int m_LastDigBlockX; int m_LastDigBlockY; diff --git a/src/Defines.h b/src/Defines.h index c2f46c241..787eacab8 100644 --- a/src/Defines.h +++ b/src/Defines.h @@ -229,7 +229,7 @@ inline const char * ClickActionToString(eClickAction a_ClickAction) -/** Returns a blockface mirrored around the Y axis (doesn't change up/down). */ +/** Returns a blockface mirrored around the Y axis (doesn't change up / down). */ inline eBlockFace MirrorBlockFaceY(eBlockFace a_BlockFace) { switch (a_BlockFace) diff --git a/src/Enchantments.h b/src/Enchantments.h index e8e84d43c..9c1c54ae9 100644 --- a/src/Enchantments.h +++ b/src/Enchantments.h @@ -14,7 +14,7 @@ -// fwd: WorldStorage/FastNBT.h +// fwd: "WorldStorage/FastNBT.h" class cFastNBTWriter; class cParsedNBT; diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index b87cf51a6..4a909a1fd 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1309,7 +1309,8 @@ bool cEntity::DetectPortal() if (IsPlayer()) { - ((cPlayer *)this)->GetClientHandle()->SendRespawn(dimOverworld); // Send a respawn packet before world is loaded/generated so the client isn't left in limbo + // Send a respawn packet before world is loaded / generated so the client isn't left in limbo + ((cPlayer *)this)->GetClientHandle()->SendRespawn(dimOverworld); } return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedOverworldName()), false); @@ -1688,8 +1689,8 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude) { m_World->BroadcastEntityRelMove(*this, (char)DiffX, (char)DiffY, (char)DiffZ, a_Exclude); } - // Clients seem to store two positions, one for the velocity packet and one for the teleport/relmove packet - // The latter is only changed with a relmove/teleport, and m_LastPos stores this position + // Clients seem to store two positions, one for the velocity packet and one for the teleport / relmove packet + // The latter is only changed with a relmove / teleport, and m_LastPos stores this position m_LastPos = GetPosition(); } else diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index dd6190ced..fecbb9bf5 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -474,7 +474,7 @@ protected: static cCriticalSection m_CSCount; static UInt32 m_EntityCount; - /** Measured in meter/second (m/s) */ + /** Measured in meters / second (m / s) */ Vector3d m_Speed; /** The ID of the entity that is guaranteed to be unique within a single run of the server. @@ -494,7 +494,7 @@ protected: /** Stores whether head yaw has been set manually */ bool m_bDirtyHead; - /** Stores whether our yaw/pitch/roll (body orientation) has been set manually */ + /** Stores whether our yaw / pitch / roll (body orientation) has been set manually */ bool m_bDirtyOrientation; /** Stores whether we have sent a Velocity packet with a speed of zero (no speed) to the client diff --git a/src/Entities/EntityEffect.cpp b/src/Entities/EntityEffect.cpp index bae686b77..c8be414d4 100644 --- a/src/Entities/EntityEffect.cpp +++ b/src/Entities/EntityEffect.cpp @@ -102,11 +102,11 @@ int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage) // If potion is level II, half the duration. If not, stays the same TierCoeff = (GetPotionEffectIntensity(a_ItemDamage) > 0) ? 0.5 : 1; - // If potion is extended, multiply duration by 8/3. If not, stays the same + // If potion is extended, multiply duration by 8 / 3. If not, stays the same // Extended potion if sixth lowest bit is set ExtCoeff = (a_ItemDamage & 0x40) ? (8.0 / 3.0) : 1; - // If potion is splash potion, multiply duration by 3/4. If not, stays the same + // If potion is splash potion, multiply duration by 3 / 4. If not, stays the same SplashCoeff = IsPotionDrinkable(a_ItemDamage) ? 1 : 0.75; // Ref.: diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp index 3d56570ba..b80759d24 100644 --- a/src/Entities/Minecart.cpp +++ b/src/Entities/Minecart.cpp @@ -905,7 +905,7 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta) } /* Check to which side the minecart is to be pushed. - Let's consider a z-x-coordinate system where the minecart is the center (0/0). + Let's consider a z-x-coordinate system where the minecart is the center (0, 0). The minecart moves along the line x = -z, the perpendicular line to this is x = z. In order to decide to which side the minecart is to be pushed, it must be checked on what side of the perpendicular line the pushing entity is located. */ if ( @@ -954,7 +954,7 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta) } /* Check to which side the minecart is to be pushed. - Let's consider a z-x-coordinate system where the minecart is the center (0/0). + Let's consider a z-x-coordinate system where the minecart is the center (0, 0). The minecart moves along the line x = z, the perpendicular line to this is x = -z. In order to decide to which side the minecart is to be pushed, it must be checked on what side of the perpendicular line the pushing entity is located. */ if ( diff --git a/src/Entities/Minecart.h b/src/Entities/Minecart.h index 898776e71..d1736e9b9 100644 --- a/src/Entities/Minecart.h +++ b/src/Entities/Minecart.h @@ -29,7 +29,7 @@ public: enum ePayload { mpNone = 0, // Empty minecart, ridable by player or mobs - mpChest = 1, // Minecart-with-chest, can store a grid of 3*8 items + mpChest = 1, // Minecart-with-chest, can store a grid of 3 * 8 items mpFurnace = 2, // Minecart-with-furnace, can be powered mpTNT = 3, // Minecart-with-TNT, can be blown up with activator rail mpHopper = 5, // Minecart-with-hopper, can be hopper @@ -54,8 +54,7 @@ protected: cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z); /** Handles physics on normal rails - For each tick, slow down on flat rails, speed up or slow down on ascending/descending rails (depending on direction), and turn on curved rails - */ + For each tick, slow down on flat rails, speed up or slow down on ascending / descending rails (depending on direction), and turn on curved rails. */ void HandleRailPhysics(NIBBLETYPE a_RailMeta, std::chrono::milliseconds a_Dt); /** Handles powered rail physics diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 7f625f5d4..607a663de 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -355,7 +355,7 @@ float cPlayer::GetXpPercentage() int currentLevel_XpBase = XpForLevel(currentLevel); return static_cast(m_CurrentXp - currentLevel_XpBase) / - static_cast(XpForLevel(1+currentLevel) - currentLevel_XpBase); + static_cast(XpForLevel(1 + currentLevel) - currentLevel_XpBase); } @@ -364,7 +364,7 @@ float cPlayer::GetXpPercentage() bool cPlayer::SetCurrentExperience(int a_CurrentXp) { - if (!(a_CurrentXp >= 0) || (a_CurrentXp > (std::numeric_limits().max() - m_LifetimeTotalXp))) + if (!(a_CurrentXp >= 0) || (a_CurrentXp > (std::numeric_limits::max() - m_LifetimeTotalXp))) { LOGWARNING("Tried to update experiece with an invalid Xp value: %d", a_CurrentXp); return false; // oops, they gave us a dodgey number @@ -403,7 +403,7 @@ int cPlayer::DeltaExperience(int a_Xp_delta) m_LifetimeTotalXp += a_Xp_delta; } - LOGD("Player \"%s\" gained/lost %d experience, total is now: %d", GetName().c_str(), a_Xp_delta, m_CurrentXp); + LOGD("Player \"%s\" gained / lost %d experience, total is now: %d", GetName().c_str(), a_Xp_delta, m_CurrentXp); // Set experience to be updated m_bDirtyExperience = true; @@ -1771,7 +1771,7 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World) m_LastBedPos.z = root.get("SpawnZ", a_World->GetSpawnZ()).asInt(); // Load the player stats. - // We use the default world name (like bukkit) because stats are shared between dimensions/worlds. + // We use the default world name (like bukkit) because stats are shared between dimensions / worlds. cStatSerializer StatSerializer(cRoot::Get()->GetDefaultWorld()->GetName(), GetName(), &m_Stats); StatSerializer.Load(); @@ -1868,7 +1868,7 @@ bool cPlayer::SaveToDisk() } // Save the player stats. - // We use the default world name (like bukkit) because stats are shared between dimensions/worlds. + // We use the default world name (like bukkit) because stats are shared between dimensions / worlds. cStatSerializer StatSerializer(cRoot::Get()->GetDefaultWorld()->GetName(), GetName(), &m_Stats); if (!StatSerializer.Save()) { @@ -2076,7 +2076,7 @@ void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos) } else { - if (Value >= 25) // Ignore small/slow movement + if (Value >= 25) // Ignore small / slow movement { m_Stats.AddValue(statDistFlown, Value); } diff --git a/src/Entities/Player.h b/src/Entities/Player.h index 4b8c01dc4..a0cd9b1d6 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -644,7 +644,7 @@ protected: virtual void Destroyed(void); - /** Filters out damage for creative mode/friendly fire */ + /** Filters out damage for creative mode / friendly fire */ virtual bool DoTakeDamage(TakeDamageInfo & TDI) override; /** Stops players from burning in creative mode */ diff --git a/src/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h index de460a8ad..7ee87f93a 100644 --- a/src/Entities/ProjectileEntity.h +++ b/src/Entities/ProjectileEntity.h @@ -109,7 +109,7 @@ protected: eKind m_ProjectileKind; /** The structure for containing the entity ID and name who has created this projectile - The ID and/or name may be nullptr (e.g. for dispensers/mobs). */ + The ID and / or name may be nullptr (e.g. for dispensers / mobs). */ CreatorData m_CreatorData; /** True if the projectile has hit the ground and is stuck there */ diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp index 1e8dbef90..0a9b170fa 100644 --- a/src/Generating/Caves.cpp +++ b/src/Generating/Caves.cpp @@ -237,7 +237,7 @@ bool cCaveTunnel::RefineDefPoints(const cCaveDefPoints & a_Src, cCaveDefPoints & return true; } - // Smoothing: for each line segment, add points on its 1/4 lengths + // Smoothing: for each line segment, add points on its 1 / 4 lengths bool res = false; size_t Num = a_Src.size() - 2; // this many intermediary points a_Dst.clear(); @@ -488,7 +488,7 @@ void cCaveTunnel::ProcessChunk( continue; } - // Carve out a sphere around the xyz point, m_Radius in diameter; skip 3/7 off the top and bottom: + // Carve out a sphere around the xyz point, m_Radius in diameter; skip 3 / 7 off the top and bottom: int DifX = itr->m_BlockX - BlockStartX; // substitution for faster calc int DifY = itr->m_BlockY; int DifZ = itr->m_BlockZ - BlockStartZ; // substitution for faster calc diff --git a/src/Generating/ChunkGenerator.cpp b/src/Generating/ChunkGenerator.cpp index 854aac60d..72d8f5258 100644 --- a/src/Generating/ChunkGenerator.cpp +++ b/src/Generating/ChunkGenerator.cpp @@ -209,7 +209,7 @@ void cChunkGenerator::Execute(void) { if ((NumChunksGenerated > 16) && (clock() - LastReportTick > CLOCKS_PER_SEC)) { - LOG("Chunk generator performance: %.2f ch/s (%d ch total)", + LOG("Chunk generator performance: %.2f ch / sec (%d ch total)", (double)NumChunksGenerated * CLOCKS_PER_SEC/ (clock() - GenerationStart), NumChunksGenerated ); @@ -241,7 +241,7 @@ void cChunkGenerator::Execute(void) // Display perf info once in a while: if ((NumChunksGenerated > 16) && (clock() - LastReportTick > 2 * CLOCKS_PER_SEC)) { - LOG("Chunk generator performance: %.2f ch/s (%d ch total)", + LOG("Chunk generator performance: %.2f ch / sec (%d ch total)", (double)NumChunksGenerated * CLOCKS_PER_SEC / (clock() - GenerationStart), NumChunksGenerated ); diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 7541c8598..00b34bddd 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -195,7 +195,7 @@ void cFinishGenGlowStone::GenFinish(cChunkDesc & a_ChunkDesc) // The maximum size for a string of glowstone can get 3 - 5 blocks long int Size = 3 + m_Noise.IntNoise3DInt(ChunkX, i, ChunkZ) % 3; - // Generate X/Z coordinates. + // Generate X / Z coordinates. int X = Size + (m_Noise.IntNoise2DInt(i, Size) % (cChunkDef::Width - Size * 2)); int Z = Size + (m_Noise.IntNoise2DInt(X, i) % (cChunkDef::Width - Size * 2)); diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp index 54567cb4d..e34ffc57c 100644 --- a/src/Generating/HeiGen.cpp +++ b/src/Generating/HeiGen.cpp @@ -667,7 +667,7 @@ public: virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) { - // Generate the biomes for the 3*3 neighbors: + // Generate the biomes for the 3 * 3 neighbors: cChunkDef::BiomeMap neighborBiomes[3][3]; for (int z = 0; z < 3; z++) for (int x = 0; x < 3; x++) { diff --git a/src/Generating/IntGen.h b/src/Generating/IntGen.h index 854563f41..9cc881639 100644 --- a/src/Generating/IntGen.h +++ b/src/Generating/IntGen.h @@ -5,7 +5,7 @@ /* The integers generated may be interpreted in several ways: -- land/see designators +- land / sea designators - 0 = ocean - >0 = land - biome group @@ -310,7 +310,7 @@ public: } } - // Copy from Cache into a_Values; take into account the even/odd offsets in a_Min: + // Copy from Cache into a_Values; take into account the even / odd offsets in a_Min: for (int z = 0; z < SizeZ; ++z) { memcpy(a_Values + z * SizeX, cache + (z + (a_MinZ & 1)) * lowStepX + (a_MinX & 1), SizeX * sizeof(int)); diff --git a/src/Generating/Noise3DGenerator.cpp b/src/Generating/Noise3DGenerator.cpp index eadc66a4e..63e88c2a8 100644 --- a/src/Generating/Noise3DGenerator.cpp +++ b/src/Generating/Noise3DGenerator.cpp @@ -680,7 +680,7 @@ void cBiomalNoise3DComposable::GenerateNoiseArrayIfNeeded(int a_ChunkX, int a_Ch void cBiomalNoise3DComposable::CalcBiomeParamArrays(int a_ChunkX, int a_ChunkZ, ChunkParam & a_HeightAmp, ChunkParam & a_MidPoint) { - // Generate the 3*3 chunks of biomes around this chunk: + // Generate the 3 * 3 chunks of biomes around this chunk: cChunkDef::BiomeMap neighborBiomes[3 * 3]; for (int z = 0; z < 3; z++) { diff --git a/src/Generating/ProtIntGen.h b/src/Generating/ProtIntGen.h index e709222fe..9e471e8bb 100644 --- a/src/Generating/ProtIntGen.h +++ b/src/Generating/ProtIntGen.h @@ -229,7 +229,7 @@ public: } } - // Copy from Cache into a_Values; take into account the even/odd offsets in a_Min: + // Copy from Cache into a_Values; take into account the even / odd offsets in a_Min: for (int z = 0; z < a_SizeZ; ++z) { memcpy(a_Values + z * a_SizeX, cache + (z + (a_MinZ & 1)) * lowStepX + (a_MinX & 1), a_SizeX * sizeof(int)); diff --git a/src/Generating/RainbowRoadsGen.cpp b/src/Generating/RainbowRoadsGen.cpp index c3c07cdec..fd4a81692 100644 --- a/src/Generating/RainbowRoadsGen.cpp +++ b/src/Generating/RainbowRoadsGen.cpp @@ -61,7 +61,7 @@ protected: /** The noise used as a pseudo-random generator */ cNoise m_Noise; - /** Maximum size, in X/Z blocks, of the village (radius from the origin) */ + /** Maximum size, in X / Z blocks, of the village (radius from the origin) */ int m_MaxSize; /** Borders of the vilalge - no item may reach out of this cuboid. */ diff --git a/src/Generating/RainbowRoadsGen.h b/src/Generating/RainbowRoadsGen.h index 5813e1d14..52d48ceca 100644 --- a/src/Generating/RainbowRoadsGen.h +++ b/src/Generating/RainbowRoadsGen.h @@ -34,7 +34,7 @@ protected: /** Maximum depth of the generator tree*/ int m_MaxDepth; - /** Maximum size, in X/Z blocks, of the base (radius from the origin) */ + /** Maximum size, in X / Z blocks, of the structure (radius from the origin) */ int m_MaxSize; diff --git a/src/Generating/Ravines.cpp b/src/Generating/Ravines.cpp index 70b9d0b62..9f8f69139 100644 --- a/src/Generating/Ravines.cpp +++ b/src/Generating/Ravines.cpp @@ -124,7 +124,7 @@ cStructGenRavines::cRavine::cRavine(int a_GridX, int a_GridZ, int a_OriginX, int void cStructGenRavines::cRavine::GenerateBaseDefPoints(int a_BlockX, int a_BlockZ, int a_Size, cNoise & a_Noise) { - // Modify the size slightly to have different-sized ravines (1/2 to 1/1 of a_Size): + // Modify the size slightly to have different-sized ravines (1 / 2 to 1 / 1 of a_Size): a_Size = (512 + ((a_Noise.IntNoise3DInt(19 * a_BlockX, 11 * a_BlockZ, a_BlockX + a_BlockZ) / 17) % 512)) * a_Size / 1024; // The complete offset of the ravine from its cellpoint, up to 2 * a_Size in each direction @@ -177,7 +177,7 @@ void cStructGenRavines::cRavine::RefineDefPoints(const cRavDefPoints & a_Src, cR return; } - // Smoothing: for each line segment, add points on its 1/4 lengths + // Smoothing: for each line segment, add points on its 1 / 4 lengths size_t Num = a_Src.size() - 2; // this many intermediary points a_Dst.clear(); a_Dst.reserve(Num * 2 + 2); diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp index 2d5a73739..7572cdcbf 100644 --- a/src/Generating/StructGen.cpp +++ b/src/Generating/StructGen.cpp @@ -311,7 +311,7 @@ void cStructGenOreNests::GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_Ore rnd /= cChunkDef::Width; int BaseY = rnd % a_MaxHeight; rnd /= a_MaxHeight; - int NestSize = a_NestSize + (rnd % (a_NestSize / 4)); // The actual nest size may be up to 1/4 larger + int NestSize = a_NestSize + (rnd % (a_NestSize / 4)); // The actual nest size may be up to 1 / 4 larger int Num = 0; while (Num < NestSize) { diff --git a/src/Generating/TestRailsGen.cpp b/src/Generating/TestRailsGen.cpp index 66ab8b33f..8256b55a0 100644 --- a/src/Generating/TestRailsGen.cpp +++ b/src/Generating/TestRailsGen.cpp @@ -61,7 +61,7 @@ protected: /** The noise used as a pseudo-random generator */ cNoise m_Noise; - /** Maximum size, in X/Z blocks, of the structure (radius from the origin) */ + /** Maximum size, in X / Z blocks, of the structure (radius from the origin) */ int m_MaxSize; /** Borders of the structure - no item may reach out of this cuboid. */ diff --git a/src/Generating/TestRailsGen.h b/src/Generating/TestRailsGen.h index 5b0ce95f4..88e38b368 100644 --- a/src/Generating/TestRailsGen.h +++ b/src/Generating/TestRailsGen.h @@ -31,10 +31,10 @@ protected: /** The noise used for generating random numbers */ cNoise m_Noise; - /** Maximum depth of the generator tree*/ + /** Maximum depth of the generator tree */ int m_MaxDepth; - /** Maximum size, in X/Z blocks, of the base (radius from the origin) */ + /** Maximum size, in X / Z blocks, of the structure (radius from the origin) */ int m_MaxSize; diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp index 9e72a688f..72fe5f819 100644 --- a/src/Generating/Trees.cpp +++ b/src/Generating/Trees.cpp @@ -499,7 +499,7 @@ void GetBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_Nois PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); h--; - // Third and fourth layers - BigO2 and maybe 2*Corners: + // Third and fourth layers - BigO2 and maybe 2 * Corners: for (int Row = 0; Row < 2; Row++) { PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); @@ -673,7 +673,7 @@ void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_ PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); h--; - // Third and fourth layers - BigO2 and maybe 2*Corners: + // Third and fourth layers - BigO2 and maybe 2 * Corners: for (int Row = 0; Row < 2; Row++) { PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH); diff --git a/src/Generating/UnderwaterBaseGen.cpp b/src/Generating/UnderwaterBaseGen.cpp index 8916f4b5f..dbc4aef1b 100644 --- a/src/Generating/UnderwaterBaseGen.cpp +++ b/src/Generating/UnderwaterBaseGen.cpp @@ -61,7 +61,7 @@ protected: /** The noise used as a pseudo-random generator */ cNoise m_Noise; - /** Maximum size, in X/Z blocks, of the village (radius from the origin) */ + /** Maximum size, in X / Z blocks, of the base (radius from the origin) */ int m_MaxSize; /** Borders of the vilalge - no item may reach out of this cuboid. */ diff --git a/src/Generating/UnderwaterBaseGen.h b/src/Generating/UnderwaterBaseGen.h index b24eb1075..9433a1905 100644 --- a/src/Generating/UnderwaterBaseGen.h +++ b/src/Generating/UnderwaterBaseGen.h @@ -34,7 +34,7 @@ protected: /** Maximum depth of the generator tree*/ int m_MaxDepth; - /** Maximum size, in X/Z blocks, of the base (radius from the origin) */ + /** Maximum size, in X / Z blocks, of the structure (radius from the origin) */ int m_MaxSize; /** The underlying biome generator that defines whether the base is created or not */ diff --git a/src/Generating/VillageGen.cpp b/src/Generating/VillageGen.cpp index f7d9a8316..a3f8caa46 100644 --- a/src/Generating/VillageGen.cpp +++ b/src/Generating/VillageGen.cpp @@ -162,7 +162,7 @@ protected: /** The noise used as a pseudo-random generator */ cNoise m_Noise; - /** Maximum size, in X/Z blocks, of the village (radius from the origin) */ + /** Maximum size, in X / Z blocks, of the village (radius from the origin) */ int m_MaxSize; /** The density for this village. Used to refrain from populating all house connectors. Range [0, 100] */ diff --git a/src/Generating/VillageGen.h b/src/Generating/VillageGen.h index ed8d739df..c384ed9e5 100644 --- a/src/Generating/VillageGen.h +++ b/src/Generating/VillageGen.h @@ -32,7 +32,7 @@ protected: /** Maximum depth of the generator tree*/ int m_MaxDepth; - /** Maximum size, in X/Z blocks, of the village (radius from the origin) */ + /** Maximum size, in X / Z blocks, of the village (radius from the origin) */ int m_MaxSize; /** Minimum density - percentage of allowed house connections. Range [0, 100] */ diff --git a/src/Globals.h b/src/Globals.h index bd180c08f..1f354ae77 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -18,9 +18,9 @@ // Useful warnings from warning level 4: #pragma warning(3 : 4189) // Local variable is initialized but not referenced - #pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed/unsigned mismatch + #pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed / unsigned mismatch #pragma warning(3 : 4310) // Cast truncates constant value - #pragma warning(3 : 4389) // Signed/unsigned mismatch + #pragma warning(3 : 4389) // Signed / unsigned mismatch #pragma warning(3 : 4505) // Unreferenced local function has been removed #pragma warning(3 : 4701) // Potentially unitialized local variable used #pragma warning(3 : 4702) // Unreachable code diff --git a/src/HTTPServer/EnvelopeParser.h b/src/HTTPServer/EnvelopeParser.h index e96d80abe..fe226d1f8 100644 --- a/src/HTTPServer/EnvelopeParser.h +++ b/src/HTTPServer/EnvelopeParser.h @@ -61,7 +61,7 @@ public: AString m_LastValue; - /** Notifies the callback of the key/value stored in m_LastKey/m_LastValue, then erases them */ + /** Notifies the callback of the key / value stored in m_LastKey / m_LastValue, then erases them */ void NotifyLast(void); /** Parses one line of header data. Returns true if successful */ diff --git a/src/HTTPServer/HTTPMessage.cpp b/src/HTTPServer/HTTPMessage.cpp index c87b3cc8b..6762a22f8 100644 --- a/src/HTTPServer/HTTPMessage.cpp +++ b/src/HTTPServer/HTTPMessage.cpp @@ -202,7 +202,7 @@ size_t cHTTPRequest::ParseRequestLine(const char * a_Data, size_t a_Size) m_IsValid = false; return AString::npos; } - // Check that there's HTTP/version at the end + // Check that there's HTTP / version at the end if (strncmp(m_IncomingHeaderData.c_str() + URLEnd + 1, "HTTP/1.", 7) != 0) { m_IsValid = false; diff --git a/src/IniFile.cpp b/src/IniFile.cpp index 3a213a90e..99c0a5f0f 100644 --- a/src/IniFile.cpp +++ b/src/IniFile.cpp @@ -1,11 +1,11 @@ // IniFile.cpp: Implementation of the CIniFile class. // Written by: Adam Clauss // Email: cabadam@houston.rr.com -// You may use this class/code as you wish in your programs. Feel free to distribute it, and +// You may use this class / code as you wish in your programs. Feel free to distribute it, and // email suggested changes to me. // // Rewritten by: Shane Hill -// Date: 21/08/2001 +// Date: 2001-08-21 // Email: Shane.Hill@dsto.defence.gov.au // Reason: Remove dependancy on MFC. Code should compile on any // platform. diff --git a/src/IniFile.h b/src/IniFile.h index 3e717723f..71fea3a00 100644 --- a/src/IniFile.h +++ b/src/IniFile.h @@ -1,14 +1,14 @@ // IniFile.cpp: Implementation of the CIniFile class. // Written by: Adam Clauss // Email: cabadam@tamu.edu -// You may use this class/code as you wish in your programs. Feel free to distribute it, and +// You may use this class / code as you wish in your programs. Feel free to distribute it, and // email suggested changes to me. // // Rewritten by: Shane Hill -// Date: 21/08/2001 +// Date: 2001-08-21 // Email: Shane.Hill@dsto.defence.gov.au // Reason: Remove dependancy on MFC. Code should compile on any -// platform. Tested on Windows/Linux/Irix +// platform. Tested on Windows / Linux / Irix //////////////////////////////////////////////////////////////////////////////// /* @@ -108,7 +108,7 @@ public: // Gets value of [keyname] valuename =. // Overloaded to return string, int, and double. - // Returns defValue if key/value not found. + // Returns defValue if key / value not found. AString GetValue (const AString & keyname, const AString & valuename, const AString & defValue = "") const; AString GetValue (const int keyID, const int valueID, const AString & defValue = "") const; double GetValueF(const AString & keyname, const AString & valuename, const double defValue = 0) const; @@ -217,7 +217,7 @@ public: -/** Reads the list of ports from the INI file, possibly upgrading from IPv4/IPv6-specific values into new version-agnostic value. +/** Reads the list of ports from the INI file, possibly upgrading from IPv4 / IPv6-specific values into new version-agnostic value. Reads the list of ports from a_PortsValueName. If that value doesn't exist or is empty, the list is combined from values in a_OldIPv4ValueName and a_OldIPv6ValueName; in this case the old values are removed from the INI file. If there is none of the three values or they are all empty, the default is used and stored in the Ports value. */ diff --git a/src/Items/ItemLighter.h b/src/Items/ItemLighter.h index 4959d52cc..24641dce6 100644 --- a/src/Items/ItemLighter.h +++ b/src/Items/ItemLighter.h @@ -64,7 +64,7 @@ public: } default: { - // Light a fire next to/on top of the block if air: + // Light a fire next to / on top of the block if air: AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace); if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height)) { diff --git a/src/Items/ItemLilypad.h b/src/Items/ItemLilypad.h index 3440a7516..7eede5864 100644 --- a/src/Items/ItemLilypad.h +++ b/src/Items/ItemLilypad.h @@ -71,7 +71,7 @@ public: cBlockInfo::FullyOccupiesVoxel(a_CBBlockType) ) { - // Can't place lilypad on air/in another block! + // Can't place lilypad on air / in another block! return true; } m_HasHitFluid = true; diff --git a/src/Map.h b/src/Map.h index 3e775231a..a764eda50 100644 --- a/src/Map.h +++ b/src/Map.h @@ -140,7 +140,7 @@ public: /** Update a circular region around the specified player. */ void UpdateRadius(cPlayer & a_Player, unsigned int a_Radius); - /** Send next update packet to the specified player and remove invalid decorators/clients. */ + /** Send next update packet to the specified player and remove invalid decorators / clients. */ void UpdateClient(cPlayer * a_Player); // tolua_begin diff --git a/src/MobCensus.cpp b/src/MobCensus.cpp index 4109aff07..1a69d8370 100644 --- a/src/MobCensus.cpp +++ b/src/MobCensus.cpp @@ -19,8 +19,8 @@ void cMobCensus::CollectMob(cMonster & a_Monster, cChunk & a_Chunk, double a_Dis bool cMobCensus::IsCapped(cMonster::eFamily a_MobFamily) { - const int ratio = 319; // This should be 256 as we are only supposed to take account from chunks that are in 17x17 from a player - // but for now, we use all chunks loaded by players. that means 19 x 19 chunks. That's why we use 256 * (19*19) / (17*17) = 319 + const int ratio = 319; // This should be 256 as we are only supposed to take account from chunks that are in 17 x 17 from a player + // but for now, we use all chunks loaded by players. that means 19 x 19 chunks. That's why we use 256 * (19 * 19) / (17 * 17) = 319 // MG TODO : code the correct count if ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio >= m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily)) { diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h index a2295777a..5d20ba810 100644 --- a/src/Mobs/Monster.h +++ b/src/Mobs/Monster.h @@ -224,7 +224,7 @@ protected: Calls ResetPathFinding and sets m_IsFollowingPath to false */ void StopMovingToPosition(); - /** Sets the body yaw and head yaw/pitch based on next/ultimate destinations */ + /** Sets the body yaw and head yaw / pitch based on next / ultimate destinations */ void SetPitchAndYawFromDestination(void); virtual void HandleFalling(void); diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h index 0d903adb6..adae77984 100644 --- a/src/Mobs/Path.h +++ b/src/Mobs/Path.h @@ -12,7 +12,7 @@ Put this in your .cpp: */ #ifdef COMPILING_PATHFIND_DEBUGGER - /* Note: the COMPILING_PATHFIND_DEBUGGER flag is used by Native/WiseOldMan95 to debug + /* Note: the COMPILING_PATHFIND_DEBUGGER flag is used by Native / WiseOldMan95 to debug this class outside of MCServer. This preprocessor flag is never set when compiling MCServer. */ #include "PathFinderIrrlicht_Head.h" #endif diff --git a/src/Noise/Noise.cpp b/src/Noise/Noise.cpp index 0249ab6c1..d11c47bc2 100644 --- a/src/Noise/Noise.cpp +++ b/src/Noise/Noise.cpp @@ -633,10 +633,10 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS }; const NOISE_DATATYPE FracX = (a_X) - BaseX; - const NOISE_DATATYPE x1interp1 = CubicInterpolate( points1[0][0], points1[0][1], points1[0][2], points1[0][3], FracX); - const NOISE_DATATYPE x1interp2 = CubicInterpolate( points1[1][0], points1[1][1], points1[1][2], points1[1][3], FracX); - const NOISE_DATATYPE x1interp3 = CubicInterpolate( points1[2][0], points1[2][1], points1[2][2], points1[2][3], FracX); - const NOISE_DATATYPE x1interp4 = CubicInterpolate( points1[3][0], points1[3][1], points1[3][2], points1[3][3], FracX); + const NOISE_DATATYPE x1interp1 = CubicInterpolate(points1[0][0], points1[0][1], points1[0][2], points1[0][3], FracX); + const NOISE_DATATYPE x1interp2 = CubicInterpolate(points1[1][0], points1[1][1], points1[1][2], points1[1][3], FracX); + const NOISE_DATATYPE x1interp3 = CubicInterpolate(points1[2][0], points1[2][1], points1[2][2], points1[2][3], FracX); + const NOISE_DATATYPE x1interp4 = CubicInterpolate(points1[3][0], points1[3][1], points1[3][2], points1[3][3], FracX); const NOISE_DATATYPE points2[4][4] = { @@ -646,45 +646,45 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS { IntNoise3D(BaseX - 1, BaseY + 2, BaseZ), IntNoise3D(BaseX, BaseY + 2, BaseZ), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ), }, }; - const NOISE_DATATYPE x2interp1 = CubicInterpolate( points2[0][0], points2[0][1], points2[0][2], points2[0][3], FracX); - const NOISE_DATATYPE x2interp2 = CubicInterpolate( points2[1][0], points2[1][1], points2[1][2], points2[1][3], FracX); - const NOISE_DATATYPE x2interp3 = CubicInterpolate( points2[2][0], points2[2][1], points2[2][2], points2[2][3], FracX); - const NOISE_DATATYPE x2interp4 = CubicInterpolate( points2[3][0], points2[3][1], points2[3][2], points2[3][3], FracX); + const NOISE_DATATYPE x2interp1 = CubicInterpolate(points2[0][0], points2[0][1], points2[0][2], points2[0][3], FracX); + const NOISE_DATATYPE x2interp2 = CubicInterpolate(points2[1][0], points2[1][1], points2[1][2], points2[1][3], FracX); + const NOISE_DATATYPE x2interp3 = CubicInterpolate(points2[2][0], points2[2][1], points2[2][2], points2[2][3], FracX); + const NOISE_DATATYPE x2interp4 = CubicInterpolate(points2[3][0], points2[3][1], points2[3][2], points2[3][3], FracX); const NOISE_DATATYPE points3[4][4] = { - { IntNoise3D( BaseX-1, BaseY-1, BaseZ+1), IntNoise3D( BaseX, BaseY-1, BaseZ+1), IntNoise3D( BaseX+1, BaseY-1, BaseZ+1), IntNoise3D( BaseX+2, BaseY-1, BaseZ + 1), }, - { IntNoise3D( BaseX-1, BaseY, BaseZ+1), IntNoise3D( BaseX, BaseY, BaseZ+1), IntNoise3D( BaseX+1, BaseY, BaseZ+1), IntNoise3D( BaseX+2, BaseY, BaseZ + 1), }, - { IntNoise3D( BaseX-1, BaseY+1, BaseZ+1), IntNoise3D( BaseX, BaseY+1, BaseZ+1), IntNoise3D( BaseX+1, BaseY+1, BaseZ+1), IntNoise3D( BaseX+2, BaseY+1, BaseZ + 1), }, - { IntNoise3D( BaseX-1, BaseY+2, BaseZ+1), IntNoise3D( BaseX, BaseY+2, BaseZ+1), IntNoise3D( BaseX+1, BaseY+2, BaseZ+1), IntNoise3D( BaseX+2, BaseY+2, BaseZ + 1), }, + { IntNoise3D(BaseX - 1, BaseY - 1, BaseZ + 1), IntNoise3D(BaseX, BaseY - 1, BaseZ + 1), IntNoise3D(BaseX + 1, BaseY - 1, BaseZ + 1), IntNoise3D(BaseX + 2, BaseY - 1, BaseZ + 1), }, + { IntNoise3D(BaseX - 1, BaseY, BaseZ + 1), IntNoise3D(BaseX, BaseY, BaseZ + 1), IntNoise3D(BaseX + 1, BaseY, BaseZ + 1), IntNoise3D(BaseX + 2, BaseY, BaseZ + 1), }, + { IntNoise3D(BaseX - 1, BaseY + 1, BaseZ + 1), IntNoise3D(BaseX, BaseY + 1, BaseZ + 1), IntNoise3D(BaseX + 1, BaseY + 1, BaseZ + 1), IntNoise3D(BaseX + 2, BaseY + 1, BaseZ + 1), }, + { IntNoise3D(BaseX - 1, BaseY + 2, BaseZ + 1), IntNoise3D(BaseX, BaseY + 2, BaseZ + 1), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ + 1), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ + 1), }, }; - const NOISE_DATATYPE x3interp1 = CubicInterpolate( points3[0][0], points3[0][1], points3[0][2], points3[0][3], FracX); - const NOISE_DATATYPE x3interp2 = CubicInterpolate( points3[1][0], points3[1][1], points3[1][2], points3[1][3], FracX); - const NOISE_DATATYPE x3interp3 = CubicInterpolate( points3[2][0], points3[2][1], points3[2][2], points3[2][3], FracX); - const NOISE_DATATYPE x3interp4 = CubicInterpolate( points3[3][0], points3[3][1], points3[3][2], points3[3][3], FracX); + const NOISE_DATATYPE x3interp1 = CubicInterpolate(points3[0][0], points3[0][1], points3[0][2], points3[0][3], FracX); + const NOISE_DATATYPE x3interp2 = CubicInterpolate(points3[1][0], points3[1][1], points3[1][2], points3[1][3], FracX); + const NOISE_DATATYPE x3interp3 = CubicInterpolate(points3[2][0], points3[2][1], points3[2][2], points3[2][3], FracX); + const NOISE_DATATYPE x3interp4 = CubicInterpolate(points3[3][0], points3[3][1], points3[3][2], points3[3][3], FracX); const NOISE_DATATYPE points4[4][4] = { - { IntNoise3D( BaseX-1, BaseY-1, BaseZ+2), IntNoise3D( BaseX, BaseY-1, BaseZ+2), IntNoise3D( BaseX+1, BaseY-1, BaseZ+2), IntNoise3D( BaseX+2, BaseY-1, BaseZ+2), }, - { IntNoise3D( BaseX-1, BaseY, BaseZ+2), IntNoise3D( BaseX, BaseY, BaseZ+2), IntNoise3D( BaseX+1, BaseY, BaseZ+2), IntNoise3D( BaseX+2, BaseY, BaseZ+2), }, - { IntNoise3D( BaseX-1, BaseY+1, BaseZ+2), IntNoise3D( BaseX, BaseY+1, BaseZ+2), IntNoise3D( BaseX+1, BaseY+1, BaseZ+2), IntNoise3D( BaseX+2, BaseY+1, BaseZ+2), }, - { IntNoise3D( BaseX-1, BaseY+2, BaseZ+2), IntNoise3D( BaseX, BaseY+2, BaseZ+2), IntNoise3D( BaseX+1, BaseY+2, BaseZ+2), IntNoise3D( BaseX+2, BaseY+2, BaseZ+2), }, + { IntNoise3D(BaseX - 1, BaseY - 1, BaseZ + 2), IntNoise3D(BaseX, BaseY - 1, BaseZ + 2), IntNoise3D(BaseX + 1, BaseY - 1, BaseZ + 2), IntNoise3D(BaseX + 2, BaseY - 1, BaseZ + 2), }, + { IntNoise3D(BaseX - 1, BaseY, BaseZ + 2), IntNoise3D(BaseX, BaseY, BaseZ + 2), IntNoise3D(BaseX + 1, BaseY, BaseZ + 2), IntNoise3D(BaseX + 2, BaseY, BaseZ + 2), }, + { IntNoise3D(BaseX - 1, BaseY + 1, BaseZ + 2), IntNoise3D(BaseX, BaseY + 1, BaseZ + 2), IntNoise3D(BaseX + 1, BaseY + 1, BaseZ + 2), IntNoise3D(BaseX + 2, BaseY + 1, BaseZ + 2), }, + { IntNoise3D(BaseX - 1, BaseY + 2, BaseZ + 2), IntNoise3D(BaseX, BaseY + 2, BaseZ + 2), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ + 2), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ + 2), }, }; - const NOISE_DATATYPE x4interp1 = CubicInterpolate( points4[0][0], points4[0][1], points4[0][2], points4[0][3], FracX); - const NOISE_DATATYPE x4interp2 = CubicInterpolate( points4[1][0], points4[1][1], points4[1][2], points4[1][3], FracX); - const NOISE_DATATYPE x4interp3 = CubicInterpolate( points4[2][0], points4[2][1], points4[2][2], points4[2][3], FracX); - const NOISE_DATATYPE x4interp4 = CubicInterpolate( points4[3][0], points4[3][1], points4[3][2], points4[3][3], FracX); + const NOISE_DATATYPE x4interp1 = CubicInterpolate(points4[0][0], points4[0][1], points4[0][2], points4[0][3], FracX); + const NOISE_DATATYPE x4interp2 = CubicInterpolate(points4[1][0], points4[1][1], points4[1][2], points4[1][3], FracX); + const NOISE_DATATYPE x4interp3 = CubicInterpolate(points4[2][0], points4[2][1], points4[2][2], points4[2][3], FracX); + const NOISE_DATATYPE x4interp4 = CubicInterpolate(points4[3][0], points4[3][1], points4[3][2], points4[3][3], FracX); const NOISE_DATATYPE FracY = (a_Y) - BaseY; - const NOISE_DATATYPE yinterp1 = CubicInterpolate( x1interp1, x1interp2, x1interp3, x1interp4, FracY); - const NOISE_DATATYPE yinterp2 = CubicInterpolate( x2interp1, x2interp2, x2interp3, x2interp4, FracY); - const NOISE_DATATYPE yinterp3 = CubicInterpolate( x3interp1, x3interp2, x3interp3, x3interp4, FracY); - const NOISE_DATATYPE yinterp4 = CubicInterpolate( x4interp1, x4interp2, x4interp3, x4interp4, FracY); + const NOISE_DATATYPE yinterp1 = CubicInterpolate(x1interp1, x1interp2, x1interp3, x1interp4, FracY); + const NOISE_DATATYPE yinterp2 = CubicInterpolate(x2interp1, x2interp2, x2interp3, x2interp4, FracY); + const NOISE_DATATYPE yinterp3 = CubicInterpolate(x3interp1, x3interp2, x3interp3, x3interp4, FracY); + const NOISE_DATATYPE yinterp4 = CubicInterpolate(x4interp1, x4interp2, x4interp3, x4interp4, FracY); const NOISE_DATATYPE FracZ = (a_Z) - BaseZ; - return CubicInterpolate( yinterp1, yinterp2, yinterp3, yinterp4, FracZ); + return CubicInterpolate(yinterp1, yinterp2, yinterp3, yinterp4, FracZ); } diff --git a/src/OSSupport/CriticalSection.h b/src/OSSupport/CriticalSection.h index d52f049d2..a95a9a0cd 100644 --- a/src/OSSupport/CriticalSection.h +++ b/src/OSSupport/CriticalSection.h @@ -13,7 +13,7 @@ public: void Lock(void); void Unlock(void); - // IsLocked/IsLockedByCurrentThread are only used in ASSERT statements, but because of the changes with ASSERT they must always be defined + // IsLocked / IsLockedByCurrentThread are only used in ASSERT statements, but because of the changes with ASSERT they must always be defined // The fake versions (in Release) will not effect the program in any way #ifdef _DEBUG cCriticalSection(void); diff --git a/src/OSSupport/File.h b/src/OSSupport/File.h index dc6543180..1b5e71a17 100644 --- a/src/OSSupport/File.h +++ b/src/OSSupport/File.h @@ -62,7 +62,7 @@ public: { fmRead, // Read-only. If the file doesn't exist, object will not be valid fmWrite, // Write-only. If the file already exists, it will be overwritten - fmReadWrite, // Read/write. If the file already exists, it will be left intact; writing will overwrite the data from the beginning + fmReadWrite, // Read / write. If the file already exists, it will be left intact; writing will overwrite the data from the beginning fmAppend // Write-only. If the file already exists cursor will be moved to the end of the file } ; diff --git a/src/OSSupport/Network.h b/src/OSSupport/Network.h index 95a935bbe..1162d7fc6 100644 --- a/src/OSSupport/Network.h +++ b/src/OSSupport/Network.h @@ -162,7 +162,7 @@ public: /** Returns the local port to which the underlying socket is bound. */ virtual UInt16 GetPort(void) const = 0; - /** Sends the specified payload in a single UDP datagram to the specified host+port combination. + /** Sends the specified payload in a single UDP datagram to the specified host + port combination. Note that in order to send to a broadcast address, you need to call EnableBroadcasts() first. */ virtual bool Send(const AString & a_Payload, const AString & a_Host, UInt16 a_Port) = 0; diff --git a/src/Protocol/MojangAPI.cpp b/src/Protocol/MojangAPI.cpp index 570754204..0d1441500 100644 --- a/src/Protocol/MojangAPI.cpp +++ b/src/Protocol/MojangAPI.cpp @@ -659,7 +659,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery) a_NamesToQuery.erase(a_NamesToQuery.begin(), itr); Json::FastWriter Writer; AString RequestBody = Writer.write(root); - + // Create the HTTP request: AString Request; Request += "POST " + m_NameToUUIDAddress + " HTTP/1.0\r\n"; // We need to use HTTP 1.0 because we don't handle Chunked transfer encoding @@ -667,7 +667,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery) Request += "User-Agent: MCServer\r\n"; Request += "Connection: close\r\n"; Request += "Content-Type: application/json\r\n"; - Request += Printf("Content-Length: %u\r\n", (unsigned)RequestBody.length()); + Request += Printf("Content-Length: %u\r\n", static_cast(RequestBody.length())); Request += "\r\n"; Request += RequestBody; diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 57631c37d..799c021f3 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -492,7 +492,7 @@ void cProtocol172::SendEntityVelocity(const cEntity & a_Entity) cPacketizer Pkt(*this, 0x12); // Entity Velocity packet Pkt.WriteBEUInt32(a_Entity.GetUniqueID()); - // 400 = 8000 / 20 ... Conversion from our speed in m/s to 8000 m/tick + // 400 = 8000 / 20 ... Conversion from our speed in m / s to 8000 m / tick Pkt.WriteBEInt16(static_cast(a_Entity.GetSpeedX() * 400)); Pkt.WriteBEInt16(static_cast(a_Entity.GetSpeedY() * 400)); Pkt.WriteBEInt16(static_cast(a_Entity.GetSpeedZ() * 400)); @@ -2514,7 +2514,7 @@ void cProtocol172::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata) for (int loretag = NBT.GetFirstChild(displaytag); loretag >= 0; loretag = NBT.GetNextSibling(loretag)) // Loop through array of strings { - AppendPrintf(Lore, "%s`", NBT.GetString(loretag).c_str()); // Append the lore with a grave accent/backtick, used internally by MCS to display a new line in the client; don't forget to c_str ;) + AppendPrintf(Lore, "%s`", NBT.GetString(loretag).c_str()); // Append the lore with a grave accent / backtick, used internally by MCS to display a new line in the client; don't forget to c_str ;) } a_Item.m_Lore = Lore; diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp index 628d8f528..1d83be8dd 100644 --- a/src/Protocol/Protocol18x.cpp +++ b/src/Protocol/Protocol18x.cpp @@ -479,7 +479,7 @@ void cProtocol180::SendEntityVelocity(const cEntity & a_Entity) cPacketizer Pkt(*this, 0x12); // Entity Velocity packet Pkt.WriteVarInt32(a_Entity.GetUniqueID()); - // 400 = 8000 / 20 ... Conversion from our speed in m/s to 8000 m/tick + // 400 = 8000 / 20 ... Conversion from our speed in m / s to 8000 m / tick Pkt.WriteBEInt16((short)(a_Entity.GetSpeedX() * 400)); Pkt.WriteBEInt16((short)(a_Entity.GetSpeedY() * 400)); Pkt.WriteBEInt16((short)(a_Entity.GetSpeedZ() * 400)); @@ -2754,7 +2754,7 @@ void cProtocol180::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata) for (int loretag = NBT.GetFirstChild(displaytag); loretag >= 0; loretag = NBT.GetNextSibling(loretag)) // Loop through array of strings { - AppendPrintf(Lore, "%s`", NBT.GetString(loretag).c_str()); // Append the lore with a grave accent/backtick, used internally by MCS to display a new line in the client; don't forget to c_str ;) + AppendPrintf(Lore, "%s`", NBT.GetString(loretag).c_str()); // Append the lore with a grave accent / backtick, used internally by MCS to display a new line in the client; don't forget to c_str ;) } a_Item.m_Lore = Lore; diff --git a/src/RankManager.cpp b/src/RankManager.cpp index 54fef5ce7..ee39026ea 100644 --- a/src/RankManager.cpp +++ b/src/RankManager.cpp @@ -2153,7 +2153,7 @@ void cRankManager::ClearPlayerRanks(void) } catch (SQLite::Exception & ex) { - LOGWARNING("%s: Failed to remove/clear all players: %s", __FUNCTION__, ex.what()); + LOGWARNING("%s: Failed to remove / clear all players: %s", __FUNCTION__, ex.what()); } } diff --git a/src/Simulator/FloodyFluidSimulator.h b/src/Simulator/FloodyFluidSimulator.h index 8e1be5e6b..0eac61a03 100644 --- a/src/Simulator/FloodyFluidSimulator.h +++ b/src/Simulator/FloodyFluidSimulator.h @@ -47,7 +47,7 @@ protected: /** Checks if there are enough neighbors to create a source at the coords specified; turns into source and returns true if so. */ bool CheckNeighborsForSource(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ); - /** Checks if the specified block should harden (Water/Lava interaction) and if so, converts it to a suitable block. + /** Checks if the specified block should harden (Water / Lava interaction) and if so, converts it to a suitable block. Returns whether the block was changed or not. */ bool HardenBlock(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta); diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp index 40be9c582..7f320af0d 100644 --- a/src/Simulator/IncrementalRedstoneSimulator.cpp +++ b/src/Simulator/IncrementalRedstoneSimulator.cpp @@ -366,7 +366,7 @@ void cIncrementalRedstoneSimulator::HandleRedstoneTorch(int a_RelBlockX, int a_R if (i + 1 < ARRAYCOUNT(gCrossCoords)) // Sides of torch, not top (top is last) { if ( - IsMechanism(Type) && // Is it a mechanism? Not block/other torch etc. + IsMechanism(Type) && // Is it a mechanism? Not block / other torch etc. (!Vector3i(a_RelBlockX + gCrossCoords[i].x, a_RelBlockY + gCrossCoords[i].y, a_RelBlockZ + gCrossCoords[i].z).Equals(Vector3i(X, Y, Z))) // CAN'T power block is that it is on ) { @@ -1600,7 +1600,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB if ((OtherRepeaterDir & 0x03) == 0x3) { return true; - } // If so, I am latched/locked + } // If so, I am latched / locked } // Check if western(left) neighbor is a powered on repeater who is facing us @@ -1612,7 +1612,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB if ((OtherRepeaterDir & 0x03) == 0x1) { return true; - } // If so, I am latched/locked + } // If so, I am latched / locked } break; @@ -1634,7 +1634,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB if ((OtherRepeaterDir & 0x30) == 0x00) { return true; - } // If so, am latched/locked + } // If so, I am latched / locked } // Check if northern(up) neighbor is a powered on repeater who is facing us @@ -1646,7 +1646,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB if ((OtherRepeaterDir & 0x03) == 0x02) { return true; - } // If so, I am latched/locked + } // If so, I am latched / locked } break; diff --git a/src/UI/DropSpenserWindow.cpp b/src/UI/DropSpenserWindow.cpp index aeb7c64b7..121836e40 100644 --- a/src/UI/DropSpenserWindow.cpp +++ b/src/UI/DropSpenserWindow.cpp @@ -1,7 +1,7 @@ // DropSpenserWindow.cpp -// Representing the UI window for the dropper/dispenser block +// Representing the UI window for the dropper / dispenser block #include "Globals.h" #include "DropSpenserWindow.h" diff --git a/src/UI/DropSpenserWindow.h b/src/UI/DropSpenserWindow.h index edff936e5..cfc040493 100644 --- a/src/UI/DropSpenserWindow.h +++ b/src/UI/DropSpenserWindow.h @@ -1,7 +1,7 @@ // DropSpenserWindow.h -// Representing the UI window for the dropper/dispenser block +// Representing the UI window for the dropper / dispenser block diff --git a/src/UI/FurnaceWindow.cpp b/src/UI/FurnaceWindow.cpp index 132439ff3..a4e852fd8 100644 --- a/src/UI/FurnaceWindow.cpp +++ b/src/UI/FurnaceWindow.cpp @@ -41,7 +41,7 @@ void cFurnaceWindow::DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & } else { - // Furnace Input/Fuel Slot + // Furnace Input / Fuel Slot AreasInOrder.push_back(m_SlotAreas[1]); /* Inventory */ AreasInOrder.push_back(m_SlotAreas[2]); /* Hotbar */ super::DistributeStackToAreas(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, false); diff --git a/src/UI/SlotArea.h b/src/UI/SlotArea.h index 0e7ba2a50..f6a9972d6 100644 --- a/src/UI/SlotArea.h +++ b/src/UI/SlotArea.h @@ -306,7 +306,7 @@ public: void UpdateResult(cPlayer & a_Player); protected: - /** The maximum cost of repairing/renaming in the anvil. */ + /** The maximum cost of repairing / renaming in the anvil. */ int m_MaximumCost; /** The stack size of the second item where was used for repair */ diff --git a/src/VoronoiMap.h b/src/VoronoiMap.h index 56022849e..a04a613d5 100644 --- a/src/VoronoiMap.h +++ b/src/VoronoiMap.h @@ -59,7 +59,7 @@ protected: cNoise m_Noise2; cNoise m_Noise3; - /** Size of the Voronoi cells (avg X/Y distance between the seeds). Expected to be at least 2. */ + /** Size of the Voronoi cells (avg X / Y distance between the seeds). Expected to be at least 2. */ int m_CellSize; /** The amount that the cell seeds may be offset from the grid. diff --git a/src/World.cpp b/src/World.cpp index 6c2e31965..d0406f078 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -176,7 +176,7 @@ protected: { float PercentDone = static_cast(m_NumPrepared * 100) / m_MaxIdx; float ChunkSpeed = static_cast((m_NumPrepared - m_LastReportChunkCount) * 1000) / std::chrono::duration_cast(Now - m_LastReportTime).count(); - LOG("Preparing spawn (%s): %.02f%% (%d/%d; %.02f chunks/s)", + LOG("Preparing spawn (%s): %.02f%% (%d/%d; %.02f chunks / sec)", m_World.GetName().c_str(), PercentDone, m_NumPrepared, m_MaxIdx, ChunkSpeed ); m_LastReportTime = Now; @@ -767,7 +767,7 @@ eWeather cWorld::ChooseNewWeather() case eWeather_Rain: { - // 1/8 chance of turning into a thunderstorm + // 1 / 8 chance of turning into a thunderstorm return ((m_TickRand.randInt() % 256) < 32) ? eWeather_ThunderStorm : eWeather_Sunny; } } diff --git a/src/World.h b/src/World.h index 624262cd3..6c0548ae6 100644 --- a/src/World.h +++ b/src/World.h @@ -152,10 +152,10 @@ public: int GetTicksUntilWeatherChange(void) const { return m_WeatherInterval; } - /** Is the daylight cyclus enabled? */ + /** Is the daylight cycle enabled? */ virtual bool IsDaylightCycleEnabled(void) const { return m_IsDaylightCycleEnabled; } - /** Sets the daylight cyclus to true/false. */ + /** Sets the daylight cycle to true / false. */ virtual void SetDaylightCycleEnabled(bool a_IsDaylightCycleEnabled) { m_IsDaylightCycleEnabled = a_IsDaylightCycleEnabled; @@ -1067,7 +1067,7 @@ private: /** Handles the weather in each tick */ void TickWeather(float a_Dt); - /** Handles the mob spawning/moving/destroying each tick */ + /** Handles the mob spawning / moving / destroying each tick */ void TickMobs(std::chrono::milliseconds a_Dt); /** Executes all tasks queued onto the tick thread */ 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)) { diff --git a/src/XMLParser.h b/src/XMLParser.h index ea341bce6..90e499785 100644 --- a/src/XMLParser.h +++ b/src/XMLParser.h @@ -168,9 +168,9 @@ public: protected: - // Parser callback enable/disable methods: + // Parser callback enable / disable methods: - // @cmember Enable/Disable the start element handler + // @cmember Enable / Disable the start element handler void EnableStartElementHandler (bool fEnable = true) { @@ -178,7 +178,7 @@ protected: XML_SetStartElementHandler (m_p, fEnable ? StartElementHandler : nullptr); } - // @cmember Enable/Disable the end element handler + // @cmember Enable / Disable the end element handler void EnableEndElementHandler (bool fEnable = true) { @@ -186,7 +186,7 @@ protected: XML_SetEndElementHandler (m_p, fEnable ? EndElementHandler : nullptr); } - // @cmember Enable/Disable the element handlers + // @cmember Enable / Disable the element handlers void EnableElementHandler (bool fEnable = true) { @@ -195,7 +195,7 @@ protected: EnableEndElementHandler (fEnable); } - // @cmember Enable/Disable the character data handler + // @cmember Enable / Disable the character data handler void EnableCharacterDataHandler (bool fEnable = true) { @@ -203,7 +203,7 @@ protected: XML_SetCharacterDataHandler (m_p, fEnable ? CharacterDataHandler : nullptr); } - // @cmember Enable/Disable the processing instruction handler + // @cmember Enable / Disable the processing instruction handler void EnableProcessingInstructionHandler (bool fEnable = true) { @@ -211,7 +211,7 @@ protected: XML_SetProcessingInstructionHandler (m_p, fEnable ? ProcessingInstructionHandler : nullptr); } - // @cmember Enable/Disable the comment handler + // @cmember Enable / Disable the comment handler void EnableCommentHandler (bool fEnable = true) { @@ -219,7 +219,7 @@ protected: XML_SetCommentHandler (m_p, fEnable ? CommentHandler : nullptr); } - // @cmember Enable/Disable the start CDATA section handler + // @cmember Enable / Disable the start CDATA section handler void EnableStartCdataSectionHandler (bool fEnable = true) { @@ -227,7 +227,7 @@ protected: XML_SetStartCdataSectionHandler (m_p, fEnable ? StartCdataSectionHandler : nullptr); } - // @cmember Enable/Disable the end CDATA section handler + // @cmember Enable / Disable the end CDATA section handler void EnableEndCdataSectionHandler (bool fEnable = true) { @@ -235,7 +235,7 @@ protected: XML_SetEndCdataSectionHandler (m_p, fEnable ? EndCdataSectionHandler : nullptr); } - // @cmember Enable/Disable the CDATA section handlers + // @cmember Enable / Disable the CDATA section handlers void EnableCdataSectionHandler (bool fEnable = true) { @@ -244,7 +244,7 @@ protected: EnableEndCdataSectionHandler (fEnable); } - // @cmember Enable/Disable default handler + // @cmember Enable / Disable default handler void EnableDefaultHandler (bool fEnable = true, bool fExpand = true) { @@ -259,7 +259,7 @@ protected: } } - // @cmember Enable/Disable external entity ref handler + // @cmember Enable / Disable external entity ref handler void EnableExternalEntityRefHandler (bool fEnable = true) { @@ -267,7 +267,7 @@ protected: XML_SetExternalEntityRefHandler (m_p, fEnable ? ExternalEntityRefHandler : nullptr); } - // @cmember Enable/Disable unknown encoding handler + // @cmember Enable / Disable unknown encoding handler void EnableUnknownEncodingHandler (bool fEnable = true) { @@ -275,7 +275,7 @@ protected: XML_SetUnknownEncodingHandler (m_p, fEnable ? UnknownEncodingHandler : nullptr); } - // @cmember Enable/Disable start namespace handler + // @cmember Enable / Disable start namespace handler void EnableStartNamespaceDeclHandler (bool fEnable = true) { @@ -283,7 +283,7 @@ protected: XML_SetStartNamespaceDeclHandler (m_p, fEnable ? StartNamespaceDeclHandler : nullptr); } - // @cmember Enable/Disable end namespace handler + // @cmember Enable / Disable end namespace handler void EnableEndNamespaceDeclHandler (bool fEnable = true) { @@ -291,7 +291,7 @@ protected: XML_SetEndNamespaceDeclHandler (m_p, fEnable ? EndNamespaceDeclHandler : nullptr); } - // @cmember Enable/Disable namespace handlers + // @cmember Enable / Disable namespace handlers void EnableNamespaceDeclHandler (bool fEnable = true) { @@ -299,7 +299,7 @@ protected: EnableEndNamespaceDeclHandler (fEnable); } - // @cmember Enable/Disable the XML declaration handler + // @cmember Enable / Disable the XML declaration handler void EnableXmlDeclHandler (bool fEnable = true) { @@ -307,7 +307,7 @@ protected: XML_SetXmlDeclHandler (m_p, fEnable ? XmlDeclHandler : nullptr); } - // @cmember Enable/Disable the start DOCTYPE declaration handler + // @cmember Enable / Disable the start DOCTYPE declaration handler void EnableStartDoctypeDeclHandler (bool fEnable = true) { @@ -315,7 +315,7 @@ protected: XML_SetStartDoctypeDeclHandler (m_p, fEnable ? StartDoctypeDeclHandler : nullptr); } - // @cmember Enable/Disable the end DOCTYPE declaration handler + // @cmember Enable / Disable the end DOCTYPE declaration handler void EnableEndDoctypeDeclHandler (bool fEnable = true) { @@ -324,7 +324,7 @@ protected: fEnable ? EndDoctypeDeclHandler : nullptr); } - // @cmember Enable/Disable the DOCTYPE declaration handler + // @cmember Enable / Disable the DOCTYPE declaration handler void EnableDoctypeDeclHandler (bool fEnable = true) { -- 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/Bindings/LuaWindow.cpp | 6 +++--- src/Bindings/ManualBindings.cpp | 12 ++++++------ src/CheckBasicStyle.lua | 12 ++++++++++-- src/Chunk.cpp | 18 +++++++++--------- src/Chunk.h | 4 ++-- src/ChunkMap.cpp | 18 +++++++++--------- src/ChunkMap.h | 13 +++++++------ src/ChunkSender.h | 2 +- src/Enchantments.h | 4 ++-- src/Endianness.h | 2 +- src/Generating/Caves.cpp | 2 +- src/Inventory.cpp | 2 +- src/Inventory.h | 2 +- src/Items/ItemChest.h | 2 +- src/Items/ItemHandler.cpp | 2 +- src/Logger.h | 8 ++++---- src/Map.cpp | 2 +- src/MobCensus.h | 4 ++-- src/MobProximityCounter.cpp | 6 +++++- src/MobProximityCounter.h | 14 +++++++------- src/MobSpawner.cpp | 4 ++-- src/MobSpawner.h | 2 +- src/MonsterConfig.h | 2 +- src/OSSupport/Semaphore.h | 2 +- src/Protocol/ChunkDataSerializer.cpp | 4 ++-- src/Root.cpp | 4 ++-- src/Root.h | 2 +- src/Scoreboard.cpp | 8 ++++---- src/Scoreboard.h | 15 ++++++--------- src/StringUtils.h | 2 +- src/Tracer.h | 5 +++-- src/UI/MinecartWithChestWindow.h | 2 +- src/WebAdmin.cpp | 2 +- src/World.cpp | 2 +- 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 +- 42 files changed, 115 insertions(+), 104 deletions(-) diff --git a/src/Bindings/LuaWindow.cpp b/src/Bindings/LuaWindow.cpp index d4014059b..5f7832ef5 100644 --- a/src/Bindings/LuaWindow.cpp +++ b/src/Bindings/LuaWindow.cpp @@ -159,7 +159,7 @@ void cLuaWindow::Destroy(void) m_Plugin->Unreference(m_LuaRef); } - // Lua will take care of this object, it will garbage-collect it, so we *must not* delete it! + // Lua will take care of this object, it will garbage-collect it, so we must not delete it! m_IsDestroyed = false; } @@ -167,10 +167,10 @@ void cLuaWindow::Destroy(void) -void cLuaWindow::DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer& a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply) +void cLuaWindow::DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply) { cSlotAreas Areas; - for (auto Area : m_SlotAreas) + for (auto && Area : m_SlotAreas) { if (Area != a_ClickedArea) { diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 20042a780..10f5ecb94 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -2557,8 +2557,8 @@ static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string, for (std::map::iterator it = a_StringStringMap.begin(); it != a_StringStringMap.end(); ++it) { - const char* key = it->first.c_str(); - const char* value = it->second.c_str(); + const char * key = it->first.c_str(); + const char * value = it->second.c_str(); lua_pushstring(tolua_S, key); lua_pushstring(tolua_S, value); lua_settable(tolua_S, top); @@ -2573,7 +2573,7 @@ static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string, static int tolua_get_HTTPRequest_Params(lua_State* tolua_S) { - HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr); + HTTPRequest * self = reinterpret_cast(tolua_tousertype(tolua_S, 1, nullptr)); return tolua_push_StringStringMap(tolua_S, self->Params); } @@ -2583,7 +2583,7 @@ static int tolua_get_HTTPRequest_Params(lua_State* tolua_S) static int tolua_get_HTTPRequest_PostParams(lua_State* tolua_S) { - HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr); + HTTPRequest * self = reinterpret_cast(tolua_tousertype(tolua_S, 1, nullptr)); return tolua_push_StringStringMap(tolua_S, self->PostParams); } @@ -2593,8 +2593,8 @@ static int tolua_get_HTTPRequest_PostParams(lua_State* tolua_S) static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S) { - HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr); - std::map< std::string, HTTPFormData >& FormData = self->FormData; + HTTPRequest * self = reinterpret_cast(tolua_tousertype(tolua_S, 1, nullptr)); + std::map & FormData = self->FormData; lua_newtable(tolua_S); int top = lua_gettop(tolua_S); diff --git a/src/CheckBasicStyle.lua b/src/CheckBasicStyle.lua index 09e64b954..133446350 100755 --- a/src/CheckBasicStyle.lua +++ b/src/CheckBasicStyle.lua @@ -164,12 +164,20 @@ local g_ViolationPatterns = -- Cannot check spaces around "-", because the minus is sometimes used as a hyphen between-words -- Check spaces around "*": - {"^[a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"}, - {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"}, + {"^[a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"}, + {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"}, + {"^[a-zB-Z0-9]+%* [a-zA-Z0-9]+", "Add space before *"}, + {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zB-Z0-9]+%* [a-zA-Z0-9]+", "Add space before *"}, -- Check spaces around "/": {"^[a-zA-Z0-9]+%/[a-zA-Z0-9]+", "Add space around /"}, {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%/[a-zA-Z0-9]+", "Add space around /"}, + + -- Check spaces around "&": + {"^[a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around /"}, + {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around /"}, + {"^[a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"}, + {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"}, } diff --git a/src/Chunk.cpp b/src/Chunk.cpp index bed5aa991..ed5a1b12a 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -472,26 +472,26 @@ void cChunk::Stay(bool a_Stay) -void cChunk::CollectMobCensus(cMobCensus& toFill) +void cChunk::CollectMobCensus(cMobCensus & toFill) { toFill.CollectSpawnableChunk(*this); - std::list playerPositions; - cPlayer* currentPlayer; - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr) + std::list playerPositions; + cPlayer * currentPlayer; + for (auto itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr) { currentPlayer = (*itr)->GetPlayer(); playerPositions.push_back(&(currentPlayer->GetPosition())); } Vector3d currentPosition; - for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) + for (auto itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) { // LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass()); if ((*itr)->IsMob()) { - cMonster& Monster = (cMonster&)(**itr); + auto & Monster = reinterpret_cast(**itr); currentPosition = Monster.GetPosition(); - for (std::list::const_iterator itr2 = playerPositions.begin(); itr2 != playerPositions.end(); ++itr2) + for (auto itr2 = playerPositions.cbegin(); itr2 != playerPositions.cend(); ++itr2) { toFill.CollectMob(Monster, *this, (currentPosition - **itr2).SqrLength()); } @@ -531,7 +531,7 @@ void cChunk::GetRandomBlockCoords(int & a_X, int & a_Y, int & a_Z) -void cChunk::SpawnMobs(cMobSpawner& a_MobSpawner) +void cChunk::SpawnMobs(cMobSpawner & a_MobSpawner) { int CenterX, CenterY, CenterZ; GetRandomBlockCoords(CenterX, CenterY, CenterZ); @@ -1839,7 +1839,7 @@ bool cChunk::SetSignLines(int a_PosX, int a_PosY, int a_PosZ, const AString & a_ -void cChunk::RemoveBlockEntity( cBlockEntity* a_BlockEntity) +void cChunk::RemoveBlockEntity(cBlockEntity * a_BlockEntity) { MarkDirty(); m_BlockEntities.remove(a_BlockEntity); diff --git a/src/Chunk.h b/src/Chunk.h index 58f6ba707..f57769107 100644 --- a/src/Chunk.h +++ b/src/Chunk.h @@ -155,10 +155,10 @@ public: void Stay(bool a_Stay = true); /** Recence all mobs proximities to players in order to know what to do with them */ - void CollectMobCensus(cMobCensus& toFill); + void CollectMobCensus(cMobCensus & toFill); /** Try to Spawn Monsters inside chunk */ - void SpawnMobs(cMobSpawner& a_MobSpawner); + void SpawnMobs(cMobSpawner & a_MobSpawner); void Tick(std::chrono::milliseconds a_Dt); diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index edff6baf1..44acc2013 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -65,7 +65,7 @@ cChunkMap::~cChunkMap() -void cChunkMap::RemoveLayer( cChunkLayer* a_Layer) +void cChunkMap::RemoveLayer(cChunkLayer * a_Layer) { cCSLock Lock(m_CSLayers); m_Layers.remove(a_Layer); @@ -2716,12 +2716,12 @@ void cChunkMap::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ) -void cChunkMap::CollectMobCensus(cMobCensus& a_ToFill) +void cChunkMap::CollectMobCensus(cMobCensus & a_ToFill) { cCSLock Lock(m_CSLayers); - for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + for (auto && layer: m_Layers) { - (*itr)->CollectMobCensus(a_ToFill); + layer->CollectMobCensus(a_ToFill); } // for itr - m_Layers } @@ -2730,12 +2730,12 @@ void cChunkMap::CollectMobCensus(cMobCensus& a_ToFill) -void cChunkMap::SpawnMobs(cMobSpawner& a_MobSpawner) +void cChunkMap::SpawnMobs(cMobSpawner & a_MobSpawner) { cCSLock Lock(m_CSLayers); - for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + for (auto && layer: m_Layers) { - (*itr)->SpawnMobs(a_MobSpawner); + layer->SpawnMobs(a_MobSpawner); } // for itr - m_Layers } @@ -2936,7 +2936,7 @@ cChunk * cChunkMap::cChunkLayer::FindChunk(int a_ChunkX, int a_ChunkZ) -void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus& a_ToFill) +void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus & a_ToFill) { for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++) { @@ -2955,7 +2955,7 @@ void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus& a_ToFill) -void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner& a_MobSpawner) +void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner & a_MobSpawner) { for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++) { diff --git a/src/ChunkMap.h b/src/ChunkMap.h index e9f1b94c0..35f66f339 100644 --- a/src/ChunkMap.h +++ b/src/ChunkMap.h @@ -64,7 +64,7 @@ public: static const int LAYER_SIZE = 32; - cChunkMap(cWorld* a_World); + cChunkMap(cWorld * a_World); ~cChunkMap(); // Broadcast respective packets to all clients of the chunk where the event is taking place @@ -364,11 +364,11 @@ public: /** Sets the blockticking to start at the specified block. Only one blocktick per chunk may be set, second call overwrites the first call */ void SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ); - /** Make a Mob census, of all mobs, their family, their chunk and theyr distance to closest player */ - void CollectMobCensus(cMobCensus& a_ToFill); + /** Make a Mob census, of all mobs, their family, their chunk and their distance to closest player */ + void CollectMobCensus(cMobCensus & a_ToFill); /** Try to Spawn Monsters inside all Chunks */ - void SpawnMobs(cMobSpawner& a_MobSpawner); + void SpawnMobs(cMobSpawner & a_MobSpawner); void Tick(std::chrono::milliseconds a_Dt); @@ -433,9 +433,10 @@ private: void UnloadUnusedChunks(void); /** Collect a mob census, of all mobs, their megatype, their chunk and their distance o closest player */ - void CollectMobCensus(cMobCensus& a_ToFill); + void CollectMobCensus(cMobCensus & a_ToFill); + /** Try to Spawn Monsters inside all Chunks */ - void SpawnMobs(cMobSpawner& a_MobSpawner); + void SpawnMobs(cMobSpawner & a_MobSpawner); void Tick(std::chrono::milliseconds a_Dt); diff --git a/src/ChunkSender.h b/src/ChunkSender.h index 7cd7ddd86..8b187c5f9 100644 --- a/src/ChunkSender.h +++ b/src/ChunkSender.h @@ -13,7 +13,7 @@ And once they do, it requests the chunk data and sends it all away, either sends to a specific client (QueueSendChunkTo) Chunk data is queried using the cChunkDataCallback interface. It is cached inside the ChunkSender object during the query and then processed after the query ends. -Note that the data needs to be compressed only *after* the query finishes, +Note that the data needs to be compressed only after the query finishes, because the query callbacks run with ChunkMap's CS locked. A client may remove itself from all direct requests(QueueSendChunkTo()) by calling RemoveClient(); diff --git a/src/Enchantments.h b/src/Enchantments.h index 9c1c54ae9..9d3f342d4 100644 --- a/src/Enchantments.h +++ b/src/Enchantments.h @@ -138,10 +138,10 @@ public: bool operator !=(const cEnchantments & a_Other) const; /** Writes the enchantments into the specified NBT writer; begins with the LIST tag of the specified name ("ench" or "StoredEnchantments") */ - friend void EnchantmentSerializer::WriteToNBTCompound(cEnchantments const& a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName); + friend void EnchantmentSerializer::WriteToNBTCompound(const cEnchantments & a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName); /** Reads the enchantments from the specified NBT list tag (ench or StoredEnchantments) */ - friend void EnchantmentSerializer::ParseFromNBT(cEnchantments& a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx); + friend void EnchantmentSerializer::ParseFromNBT(cEnchantments & a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx); protected: /** Maps enchantment ID -> enchantment level */ diff --git a/src/Endianness.h b/src/Endianness.h index ed9637fcc..a415903a5 100644 --- a/src/Endianness.h +++ b/src/Endianness.h @@ -21,7 +21,7 @@ inline UInt64 HostToNetwork8(const void * a_Value) -inline UInt32 HostToNetwork4(const void* a_Value) +inline UInt32 HostToNetwork4(const void * a_Value) { UInt32 buf; memcpy( &buf, a_Value, sizeof( buf)); diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp index 0a9b170fa..0a3673711 100644 --- a/src/Generating/Caves.cpp +++ b/src/Generating/Caves.cpp @@ -529,7 +529,7 @@ void cCaveTunnel::ProcessChunk( /* #ifdef _DEBUG - // For debugging purposes, outline the shape of the cave using glowstone, *after* carving the entire cave: + // For debugging purposes, outline the shape of the cave using glowstone, after carving the entire cave: for (cCaveDefPoints::const_iterator itr = m_Points.begin(), end = m_Points.end(); itr != end; ++itr) { int DifX = itr->m_BlockX - BlockStartX; // substitution for faster calc diff --git a/src/Inventory.cpp b/src/Inventory.cpp index fba6f4aea..c595da5b0 100644 --- a/src/Inventory.cpp +++ b/src/Inventory.cpp @@ -499,7 +499,7 @@ int cInventory::ArmorSlotNumToEntityEquipmentID(short a_ArmorSlotNum) #if 0 -bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode /* = 0 */) +bool cInventory::AddToBar(cItem & a_Item, const int a_Offset, const int a_Size, bool * a_bChangedSlots, int a_Mode /* = 0 */) { // Fill already present stacks if (a_Mode < 2) diff --git a/src/Inventory.h b/src/Inventory.h index 311f64562..b2a8f658b 100644 --- a/src/Inventory.h +++ b/src/Inventory.h @@ -171,7 +171,7 @@ public: bool LoadFromJson(Json::Value & a_Value); protected: - bool AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode = 0); + bool AddToBar(cItem & a_Item, const int a_Offset, const int a_Size, bool * a_bChangedSlots, int a_Mode = 0); cItemGrid m_ArmorSlots; cItemGrid m_InventorySlots; diff --git a/src/Items/ItemChest.h b/src/Items/ItemChest.h index b6579c423..1d23975cd 100644 --- a/src/Items/ItemChest.h +++ b/src/Items/ItemChest.h @@ -78,7 +78,7 @@ public: !BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision(&a_Player, PlaceMeta) ) { - // Tried to place a block *into* another? + // Tried to place a block into another? // Happens when you place a block aiming at side of block with a torch on it or stem beside it return false; } diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index 7328456b4..b7f89809e 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -362,7 +362,7 @@ bool cItemHandler::OnPlayerPlace( !BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision(&a_Player, PlaceMeta) ) { - // Tried to place a block *into* another? + // Tried to place a block into another? // Happens when you place a block aiming at side of block with a torch on it or stem beside it return false; } diff --git a/src/Logger.h b/src/Logger.h index 5e65de8a8..176c6e810 100644 --- a/src/Logger.h +++ b/src/Logger.h @@ -46,10 +46,10 @@ private: -extern void LOG(const char* a_Format, ...) FORMATSTRING(1, 2); -extern void LOGINFO(const char* a_Format, ...) FORMATSTRING(1, 2); -extern void LOGWARN(const char* a_Format, ...) FORMATSTRING(1, 2); -extern void LOGERROR(const char* a_Format, ...) FORMATSTRING(1, 2); +extern void LOG (const char * a_Format, ...) FORMATSTRING(1, 2); +extern void LOGINFO (const char * a_Format, ...) FORMATSTRING(1, 2); +extern void LOGWARN (const char * a_Format, ...) FORMATSTRING(1, 2); +extern void LOGERROR(const char * a_Format, ...) FORMATSTRING(1, 2); diff --git a/src/Map.cpp b/src/Map.cpp index 5e57cc8ec..5f296a5b2 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -591,7 +591,7 @@ void cMap::SendTo(cClientHandle & a_Client) for (unsigned int i = 0; i < m_Width; ++i) { - const Byte* Colors = &m_Data[i * m_Height]; + const Byte * Colors = &m_Data[i * m_Height]; a_Client.SendMapColumn(m_ID, i, 0, Colors, m_Height, m_Scale); } diff --git a/src/MobCensus.h b/src/MobCensus.h index e3892bec6..3dc7b2a8e 100644 --- a/src/MobCensus.h +++ b/src/MobCensus.h @@ -32,8 +32,8 @@ public: // MG TODO : code the correct rule (not loaded chunk but short distant from players) void CollectSpawnableChunk(cChunk & a_Chunk); - /// Collect a mob - it's distance to player, it's family ... - void CollectMob(cMonster& a_Monster, cChunk& a_Chunk, double a_Distance); + /// Collect a mob - its distance to player, its family ... + void CollectMob(cMonster & a_Monster, cChunk & a_Chunk, double a_Distance); /// Returns true if the family is capped (i.e. there are more mobs of this family than max) bool IsCapped(cMonster::eFamily a_MobFamily); diff --git a/src/MobProximityCounter.cpp b/src/MobProximityCounter.cpp index cfd52440b..1bdac2f88 100644 --- a/src/MobProximityCounter.cpp +++ b/src/MobProximityCounter.cpp @@ -6,7 +6,11 @@ #include "Entities/Entity.h" #include "Chunk.h" -void cMobProximityCounter::CollectMob(cEntity& a_Monster, cChunk& a_Chunk, double a_Distance) + + + + +void cMobProximityCounter::CollectMob(cEntity & a_Monster, cChunk & a_Chunk, double a_Distance) { // LOGD("Collecting monster %s, with distance %f", a_Monster->GetClass(), a_Distance); tMonsterToDistance::iterator it = m_MonsterToDistance.find(&a_Monster); diff --git a/src/MobProximityCounter.h b/src/MobProximityCounter.h index 2dabeaa21..a3c0c125a 100644 --- a/src/MobProximityCounter.h +++ b/src/MobProximityCounter.h @@ -16,19 +16,19 @@ protected : // structs used for later maps (see m_MonsterToDistance and m_DistanceToMonster) struct sDistanceAndChunk { - sDistanceAndChunk(double a_Distance, cChunk& a_Chunk) : m_Distance(a_Distance), m_Chunk(&a_Chunk) {} + sDistanceAndChunk(double a_Distance, cChunk & a_Chunk) : m_Distance(a_Distance), m_Chunk(&a_Chunk) {} double m_Distance; - cChunk* m_Chunk; + cChunk * m_Chunk; }; struct sMonsterAndChunk { - sMonsterAndChunk(cEntity& a_Monster, cChunk& a_Chunk) : m_Monster(a_Monster), m_Chunk(a_Chunk) {} - cEntity& m_Monster; - cChunk& m_Chunk; + sMonsterAndChunk(cEntity & a_Monster, cChunk & a_Chunk) : m_Monster(a_Monster), m_Chunk(a_Chunk) {} + cEntity & m_Monster; + cChunk & m_Chunk; }; public : - typedef std::map tMonsterToDistance; + typedef std::map tMonsterToDistance; typedef std::multimap tDistanceToMonster; protected : @@ -50,7 +50,7 @@ public : // count a mob on a specified chunk with specified distance to an unkown player // if the distance is shortest than the one collected, this become the new closest // distance and the chunk become the "hosting" chunk (that is the one that will perform the action) - void CollectMob(cEntity& a_Monster, cChunk& a_Chunk, double a_Distance); + void CollectMob(cEntity & a_Monster, cChunk & a_Chunk, double a_Distance); // return the mobs that are within the range of distance of the closest player they are // that means that if a mob is 30 m from a player and 150 m from another one. It will be diff --git a/src/MobSpawner.cpp b/src/MobSpawner.cpp index dfeab1461..468b0cfb2 100644 --- a/src/MobSpawner.cpp +++ b/src/MobSpawner.cpp @@ -321,9 +321,9 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_R -cMonster* cMobSpawner::TryToSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int& a_MaxPackSize) +cMonster * cMobSpawner::TryToSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int & a_MaxPackSize) { - cMonster* toReturn = nullptr; + cMonster * toReturn = nullptr; if (m_NewPack) { m_MobType = ChooseMobType(a_Biome); diff --git a/src/MobSpawner.h b/src/MobSpawner.h index e8b8f191b..8b651d6bf 100644 --- a/src/MobSpawner.h +++ b/src/MobSpawner.h @@ -39,7 +39,7 @@ public : // if this is the first of a Pack : determine the type of monster // BlockType & BlockMeta are used to decide what kind of Mob can Spawn here // MaxPackSize is set to the maximal size for a pack this type of mob - cMonster * TryToSpawnHere(cChunk * a_Chunk, int A_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int& a_MaxPackSize); + cMonster * TryToSpawnHere(cChunk * a_Chunk, int A_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int & a_MaxPackSize); // mark the beginning of a new Pack // all mobs of the same Pack are the same type diff --git a/src/MonsterConfig.h b/src/MonsterConfig.h index 371d324c2..50979c44a 100644 --- a/src/MonsterConfig.h +++ b/src/MonsterConfig.h @@ -23,7 +23,7 @@ public: private: struct sAttributesStruct; struct sMonsterConfigState; - sMonsterConfigState* m_pState; + sMonsterConfigState * m_pState; void Initialize(); } ; diff --git a/src/OSSupport/Semaphore.h b/src/OSSupport/Semaphore.h index adc531ed8..57fa4bdb2 100644 --- a/src/OSSupport/Semaphore.h +++ b/src/OSSupport/Semaphore.h @@ -9,7 +9,7 @@ public: void Wait(); void Signal(); private: - void* m_Handle; // HANDLE pointer + void * m_Handle; // HANDLE pointer #ifndef _WIN32 bool m_bNamed; diff --git a/src/Protocol/ChunkDataSerializer.cpp b/src/Protocol/ChunkDataSerializer.cpp index 60fd5f935..2b9c06779 100644 --- a/src/Protocol/ChunkDataSerializer.cpp +++ b/src/Protocol/ChunkDataSerializer.cpp @@ -68,7 +68,7 @@ const AString & cChunkDataSerializer::Serialize(int a_Version, int a_ChunkX, int void cChunkDataSerializer::Serialize29(AString & a_Data) { - // TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib *can* stream) + // TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib can stream) const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width; const int MetadataOffset = sizeof(m_BlockTypes); @@ -126,7 +126,7 @@ void cChunkDataSerializer::Serialize29(AString & a_Data) void cChunkDataSerializer::Serialize39(AString & a_Data) { - // TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib *can* stream) + // TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib can stream) const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width; const int MetadataOffset = sizeof(m_BlockTypes); diff --git a/src/Root.cpp b/src/Root.cpp index 1379b01a2..349608e8d 100644 --- a/src/Root.cpp +++ b/src/Root.cpp @@ -311,8 +311,8 @@ void cRoot::LoadWorlds(cIniFile & IniFile) continue; } FoundAdditionalWorlds = true; - cWorld* NewWorld = new cWorld( WorldName.c_str()); - m_WorldsByName[ WorldName ] = NewWorld; + cWorld * NewWorld = new cWorld(WorldName.c_str()); + m_WorldsByName[WorldName] = NewWorld; } // for i - Worlds if (!FoundAdditionalWorlds) diff --git a/src/Root.h b/src/Root.h index 2f9d1eb2c..e0b6cf26c 100644 --- a/src/Root.h +++ b/src/Root.h @@ -218,7 +218,7 @@ private: /// Does the actual work of executing a command void DoExecuteConsoleCommand(const AString & a_Cmd); - static cRoot* s_Root; + static cRoot * s_Root; static void InputThread(cRoot & a_Params); }; // tolua_export diff --git a/src/Scoreboard.cpp b/src/Scoreboard.cpp index adce8b549..a4a4c3391 100644 --- a/src/Scoreboard.cpp +++ b/src/Scoreboard.cpp @@ -286,7 +286,7 @@ cScoreboard::cScoreboard(cWorld * a_World) : m_World(a_World) -cObjective* cScoreboard::RegisterObjective(const AString & a_Name, const AString & a_DisplayName, cObjective::eType a_Type) +cObjective * cScoreboard::RegisterObjective(const AString & a_Name, const AString & a_DisplayName, cObjective::eType a_Type) { cObjective Objective(a_Name, a_DisplayName, a_Type, m_World); @@ -471,7 +471,7 @@ cObjective * cScoreboard::GetObjectiveIn(eDisplaySlot a_Slot) -bool cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback) +bool cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback & a_Callback) { cCSLock Lock(m_CSObjectives); @@ -493,7 +493,7 @@ bool cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallb -bool cScoreboard::ForEachObjective(cObjectiveCallback& a_Callback) +bool cScoreboard::ForEachObjective(cObjectiveCallback & a_Callback) { cCSLock Lock(m_CSObjectives); @@ -512,7 +512,7 @@ bool cScoreboard::ForEachObjective(cObjectiveCallback& a_Callback) -bool cScoreboard::ForEachTeam(cTeamCallback& a_Callback) +bool cScoreboard::ForEachTeam(cTeamCallback & a_Callback) { cCSLock Lock(m_CSTeams); diff --git a/src/Scoreboard.h b/src/Scoreboard.h index dd4073c89..ab10b20aa 100644 --- a/src/Scoreboard.h +++ b/src/Scoreboard.h @@ -262,19 +262,16 @@ public: cTeam * QueryPlayerTeam(const AString & a_Name); // WARNING: O(n logn) /** Execute callback for each objective with the specified type - Returns true if all objectives processed, false if the callback aborted by returning true. - */ - bool ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback); + Returns true if all objectives processed, false if the callback aborted by returning true. */ + bool ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback & a_Callback); /** Execute callback for each objective. - Returns true if all objectives have been processed, false if the callback aborted by returning true. - */ - bool ForEachObjective(cObjectiveCallback& a_Callback); // Exported in ManualBindings.cpp + Returns true if all objectives have been processed, false if the callback aborted by returning true. */ + bool ForEachObjective(cObjectiveCallback & a_Callback); // Exported in ManualBindings.cpp /** Execute callback for each team. - Returns true if all teams have been processed, false if the callback aborted by returning true. - */ - bool ForEachTeam(cTeamCallback& a_Callback); // Exported in ManualBindings.cpp + Returns true if all teams have been processed, false if the callback aborted by returning true. */ + bool ForEachTeam(cTeamCallback & a_Callback); // Exported in ManualBindings.cpp void SetDisplay(cObjective * a_Objective, eDisplaySlot a_Slot); diff --git a/src/StringUtils.h b/src/StringUtils.h index 785197763..b5fc58a2d 100644 --- a/src/StringUtils.h +++ b/src/StringUtils.h @@ -75,7 +75,7 @@ extern int NoCaseCompare(const AString & s1, const AString & s2); // tolua_expo /** Case-insensitive string comparison that returns a rating of equal-ness between [0 - s1.length()]. */ extern size_t RateCompareString(const AString & s1, const AString & s2); -/** Replaces *each* occurence of iNeedle in iHayStack with iReplaceWith */ +/** Replaces each occurence of iNeedle in iHayStack with iReplaceWith */ extern void ReplaceString(AString & iHayStack, const AString & iNeedle, const AString & iReplaceWith); // tolua_export /** Converts a stream of BE shorts into UTF-8 string; returns a_UTF8. */ diff --git a/src/Tracer.h b/src/Tracer.h index 31531719f..55c21546b 100644 --- a/src/Tracer.h +++ b/src/Tracer.h @@ -64,8 +64,9 @@ private: int GetHitNormal( const Vector3f & start, const Vector3f & end, const Vector3i & a_BlockPos); /// Signum function - int SigNum( float a_Num); - cWorld* m_World; + int SigNum(float a_Num); + + cWorld * m_World; static const std::array & m_NormalTable(void); diff --git a/src/UI/MinecartWithChestWindow.h b/src/UI/MinecartWithChestWindow.h index a2b5283a6..87e8f6137 100644 --- a/src/UI/MinecartWithChestWindow.h +++ b/src/UI/MinecartWithChestWindow.h @@ -33,7 +33,7 @@ public: a_ChestCart->GetWorld()->BroadcastSoundEffect("random.chestopen", a_ChestCart->GetPosX(), a_ChestCart->GetPosY(), a_ChestCart->GetPosZ(), 1, 1); } - virtual void DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea* a_ClickedArea, bool a_ShouldApply) override + virtual void DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply) override { cSlotAreas AreasInOrder; diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp index 484626de3..1cb4463e1 100644 --- a/src/WebAdmin.cpp +++ b/src/WebAdmin.cpp @@ -531,7 +531,7 @@ AString cWebAdmin::GetDefaultPage(void) -AString cWebAdmin::GetBaseURL( const AString& a_URL) +AString cWebAdmin::GetBaseURL(const AString & a_URL) { return GetBaseURL(StringSplit(a_URL, "/")); } diff --git a/src/World.cpp b/src/World.cpp index d0406f078..648c9cd19 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -1351,7 +1351,7 @@ bool cWorld::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBloc -bool cWorld::DoWithBeaconAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBeaconCallback& a_Callback) +bool cWorld::DoWithBeaconAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBeaconCallback & a_Callback) { return m_ChunkMap->DoWithBeaconAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); } 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 From 756d31031843c3363c991477fa7788b11894d619 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 9 May 2015 11:40:06 +0200 Subject: Added check against "Type const &" and "Type const *". --- src/CheckBasicStyle.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CheckBasicStyle.lua b/src/CheckBasicStyle.lua index 133446350..9ff47634d 100755 --- a/src/CheckBasicStyle.lua +++ b/src/CheckBasicStyle.lua @@ -178,6 +178,10 @@ local g_ViolationPatterns = {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%&[a-zA-Z0-9]+", "Add space around /"}, {"^[a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"}, {"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%& [a-zA-Z0-9]+", "Add space before &"}, + + -- We don't like "Type const *" and "Type const &". Use "const Type *" and "const Type &" instead: + {"const %&", "Use 'const Type &' instead of 'Type const &'"}, + {"const %*", "Use 'const Type *' instead of 'Type const *'"}, } -- cgit v1.2.3 From 8a576a0a35d0db0cfe510213bfb5ec5af1323777 Mon Sep 17 00:00:00 2001 From: wiseoldman95 Date: Sun, 10 May 2015 09:08:42 +0300 Subject: PF - Less calcs per tick --- src/Mobs/Path.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mobs/Path.cpp b/src/Mobs/Path.cpp index 8abbc4cac..ba7d615ae 100644 --- a/src/Mobs/Path.cpp +++ b/src/Mobs/Path.cpp @@ -8,7 +8,7 @@ #define DISTANCE_MANHATTAN 0 // 1: More speed, a bit less accuracy 0: Max accuracy, less speed. #define HEURISTICS_ONLY 0 // 1: Much more speed, much less accurate. -#define CALCULATIONS_PER_STEP 60 // Higher means more CPU load but faster path calculations. +#define CALCULATIONS_PER_STEP 5 // Higher means more CPU load but faster path calculations. // The only version which guarantees the shortest path is 0, 0. enum class eCellStatus {OPENLIST, CLOSEDLIST, NOLIST}; -- cgit v1.2.3