Permalink
Browse files

More style checking.

Spaces around some operators are checked.
  • Loading branch information...
madmaxoft committed May 6, 2015
1 parent 68614e7 commit 06997fa07880cca091ccefd7c64dd8e26b86cd64
Showing with 212 additions and 190 deletions.
  1. +2 −2 src/Bindings/LuaState.cpp
  2. +1 −1 src/Bindings/PluginLua.h
  3. +1 −1 src/BlockEntities/MobHeadEntity.cpp
  4. +1 −1 src/BlockEntities/MobHeadEntity.h
  5. +1 −1 src/Blocks/BlockComparator.h
  6. +3 −3 src/Blocks/BlockDoor.cpp
  7. +3 −3 src/Blocks/BlockFire.h
  8. +1 −1 src/Blocks/BlockLever.h
  9. +1 −1 src/Blocks/BlockPiston.h
  10. +8 −8 src/Blocks/BlockRail.h
  11. +1 −1 src/Blocks/BlockTrapdoor.h
  12. +2 −2 src/BoundingBox.h
  13. +21 −0 src/CheckBasicStyle.lua
  14. +3 −3 src/Chunk.cpp
  15. +6 −6 src/ClientHandle.cpp
  16. +2 −2 src/ClientHandle.h
  17. +1 −1 src/Defines.h
  18. +1 −1 src/Enchantments.h
  19. +4 −3 src/Entities/Entity.cpp
  20. +2 −2 src/Entities/Entity.h
  21. +2 −2 src/Entities/EntityEffect.cpp
  22. +2 −2 src/Entities/Minecart.cpp
  23. +2 −3 src/Entities/Minecart.h
  24. +6 −6 src/Entities/Player.cpp
  25. +1 −1 src/Entities/Player.h
  26. +1 −1 src/Entities/ProjectileEntity.h
  27. +2 −2 src/Generating/Caves.cpp
  28. +2 −2 src/Generating/ChunkGenerator.cpp
  29. +1 −1 src/Generating/FinishGen.cpp
  30. +1 −1 src/Generating/HeiGen.cpp
  31. +2 −2 src/Generating/IntGen.h
  32. +1 −1 src/Generating/Noise3DGenerator.cpp
  33. +1 −1 src/Generating/ProtIntGen.h
  34. +1 −1 src/Generating/RainbowRoadsGen.cpp
  35. +1 −1 src/Generating/RainbowRoadsGen.h
  36. +2 −2 src/Generating/Ravines.cpp
  37. +1 −1 src/Generating/StructGen.cpp
  38. +1 −1 src/Generating/TestRailsGen.cpp
  39. +2 −2 src/Generating/TestRailsGen.h
  40. +2 −2 src/Generating/Trees.cpp
  41. +1 −1 src/Generating/UnderwaterBaseGen.cpp
  42. +1 −1 src/Generating/UnderwaterBaseGen.h
  43. +1 −1 src/Generating/VillageGen.cpp
  44. +1 −1 src/Generating/VillageGen.h
  45. +2 −2 src/Globals.h
  46. +1 −1 src/HTTPServer/EnvelopeParser.h
  47. +1 −1 src/HTTPServer/HTTPMessage.cpp
  48. +2 −2 src/IniFile.cpp
  49. +5 −5 src/IniFile.h
  50. +1 −1 src/Items/ItemLighter.h
  51. +1 −1 src/Items/ItemLilypad.h
  52. +1 −1 src/Map.h
  53. +2 −2 src/MobCensus.cpp
  54. +1 −1 src/Mobs/Monster.h
  55. +1 −1 src/Mobs/Path.h
  56. +29 −29 src/Noise/Noise.cpp
  57. +1 −1 src/OSSupport/CriticalSection.h
  58. +1 −1 src/OSSupport/File.h
  59. +1 −1 src/OSSupport/Network.h
  60. +2 −2 src/Protocol/Authenticator.cpp
  61. +5 −4 src/Protocol/MojangAPI.cpp
  62. +2 −2 src/Protocol/Protocol17x.cpp
  63. +2 −2 src/Protocol/Protocol18x.cpp
  64. +1 −1 src/RankManager.cpp
  65. +1 −1 src/Simulator/FloodyFluidSimulator.h
  66. +5 −5 src/Simulator/IncrementalRedstoneSimulator.cpp
  67. +1 −1 src/UI/DropSpenserWindow.cpp
  68. +1 −1 src/UI/DropSpenserWindow.h
  69. +1 −1 src/UI/FurnaceWindow.cpp
  70. +1 −1 src/UI/SlotArea.h
  71. +1 −1 src/VoronoiMap.h
  72. +2 −2 src/World.cpp
  73. +3 −3 src/World.h
  74. +1 −1 src/WorldStorage/FastNBT.h
  75. +4 −4 src/WorldStorage/MapSerializer.cpp
  76. +1 −1 src/WorldStorage/ScoreboardSerializer.cpp
  77. +1 −1 src/WorldStorage/StatSerializer.cpp
  78. +4 −4 src/WorldStorage/WSSAnvil.cpp
  79. +20 −20 src/XMLParser.h
@@ -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);
View
@@ -20,7 +20,7 @@
// fwd: UI/Window.h
// fwd: "UI/Window.h"
class cWindow;
@@ -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"
@@ -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
@@ -22,7 +22,7 @@ class cBlockComparatorHandler :
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);
}
View
@@ -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.
View
@@ -106,7 +106,7 @@ class cBlockFireHandler :
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 @@ class cBlockFireHandler :
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 @@ class cBlockFireHandler :
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;
View
@@ -19,7 +19,7 @@ class cBlockLeverHandler :
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);
View
@@ -108,7 +108,7 @@ class cBlockPistonHandler :
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:
View
@@ -502,11 +502,11 @@ class cBlockRailHandler :
// 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 @@ class cBlockRailHandler :
// 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 @@ class cBlockRailHandler :
// 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 @@ class cBlockRailHandler :
// 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
@@ -35,7 +35,7 @@ class cBlockTrapdoorHandler :
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);
View
@@ -57,10 +57,10 @@ class cBoundingBox
/// 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
View
@@ -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 /"},
}
View
@@ -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()
);
View
@@ -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;
}
View
@@ -389,7 +389,7 @@ class cClientHandle // tolua_export
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;
@@ -414,7 +414,7 @@ class cClientHandle // tolua_export
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;
View
@@ -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)
View
@@ -14,7 +14,7 @@
// fwd: WorldStorage/FastNBT.h
// fwd: "WorldStorage/FastNBT.h"
class cFastNBTWriter;
class cParsedNBT;
View
@@ -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
View
@@ -474,7 +474,7 @@ class cEntity
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 @@ class cEntity
/** 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
@@ -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.:
Oops, something went wrong.

0 comments on commit 06997fa

Please sign in to comment.