1
0

Merge pull request #1954 from mc-server/MoreStyleCheck

More style checking.
This commit is contained in:
Mattes D 2015-05-09 13:22:59 +02:00
commit ca949447ee
112 changed files with 324 additions and 288 deletions

View File

@ -19,13 +19,13 @@ extern "C"
#include "../Entities/Entity.h" #include "../Entities/Entity.h"
#include "../BlockEntities/BlockEntity.h" #include "../BlockEntities/BlockEntity.h"
// fwd: SQLite/lsqlite3.c // fwd: "SQLite/lsqlite3.c"
extern "C" extern "C"
{ {
int luaopen_lsqlite3(lua_State * L); int luaopen_lsqlite3(lua_State * L);
} }
// fwd: LuaExpat/lxplib.c: // fwd: "LuaExpat/lxplib.c":
extern "C" extern "C"
{ {
int luaopen_lxp(lua_State * L); int luaopen_lxp(lua_State * L);

View File

@ -159,7 +159,7 @@ void cLuaWindow::Destroy(void)
m_Plugin->Unreference(m_LuaRef); 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; 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; cSlotAreas Areas;
for (auto Area : m_SlotAreas) for (auto && Area : m_SlotAreas)
{ {
if (Area != a_ClickedArea) if (Area != a_ClickedArea)
{ {

View File

@ -2557,8 +2557,8 @@ static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string,
for (std::map<std::string, std::string>::iterator it = a_StringStringMap.begin(); it != a_StringStringMap.end(); ++it) for (std::map<std::string, std::string>::iterator it = a_StringStringMap.begin(); it != a_StringStringMap.end(); ++it)
{ {
const char* key = it->first.c_str(); const char * key = it->first.c_str();
const char* value = it->second.c_str(); const char * value = it->second.c_str();
lua_pushstring(tolua_S, key); lua_pushstring(tolua_S, key);
lua_pushstring(tolua_S, value); lua_pushstring(tolua_S, value);
lua_settable(tolua_S, top); 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) static int tolua_get_HTTPRequest_Params(lua_State* tolua_S)
{ {
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr); HTTPRequest * self = reinterpret_cast<HTTPRequest *>(tolua_tousertype(tolua_S, 1, nullptr));
return tolua_push_StringStringMap(tolua_S, self->Params); 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) static int tolua_get_HTTPRequest_PostParams(lua_State* tolua_S)
{ {
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr); HTTPRequest * self = reinterpret_cast<HTTPRequest *>(tolua_tousertype(tolua_S, 1, nullptr));
return tolua_push_StringStringMap(tolua_S, self->PostParams); 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) static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S)
{ {
HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S, 1, nullptr); HTTPRequest * self = reinterpret_cast<HTTPRequest *>(tolua_tousertype(tolua_S, 1, nullptr));
std::map< std::string, HTTPFormData >& FormData = self->FormData; std::map<std::string, HTTPFormData> & FormData = self->FormData;
lua_newtable(tolua_S); lua_newtable(tolua_S);
int top = lua_gettop(tolua_S); int top = lua_gettop(tolua_S);

View File

@ -20,7 +20,7 @@
// fwd: UI/Window.h // fwd: "UI/Window.h"
class cWindow; class cWindow;

View File

@ -1,7 +1,7 @@
// MobHeadEntity.cpp // 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 "Globals.h"
#include "MobHeadEntity.h" #include "MobHeadEntity.h"

View File

@ -1,6 +1,6 @@
// MobHeadEntity.h // 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

View File

@ -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 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); 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); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
} }

View File

@ -134,7 +134,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta)
return a_Meta; return a_Meta;
} }
// Holds open/closed meta data. 0x0C == 1100. // Holds open / closed meta data. 0x0C == 1100.
NIBBLETYPE OtherMeta = a_Meta & 0x0C; NIBBLETYPE OtherMeta = a_Meta & 0x0C;
// Mirrors according to a table. 0x03 == 0011. // Mirrors according to a table. 0x03 == 0011.
@ -152,7 +152,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta)
NIBBLETYPE cBlockDoorHandler::MetaMirrorYZ(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) // 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 // 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; return a_Meta;
} }
// Holds open/closed meta data. 0x0C == 1100. // Holds open / closed meta data. 0x0C == 1100.
NIBBLETYPE OtherMeta = a_Meta & 0x0C; NIBBLETYPE OtherMeta = a_Meta & 0x0C;
// Mirrors according to a table. 0x03 == 0011. // Mirrors according to a table. 0x03 == 0011.

View File

@ -106,7 +106,7 @@ public:
void FindAndSetPortalFrame(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface) 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 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 :( if (MaxY == 0) // Oh noes! Not a portal coordinate :(
{ {
@ -139,7 +139,7 @@ public:
return; 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 */ 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) bool FindPortalSliceX(int X1, int X2, int Y, int Z, int MaxY, cChunkInterface & a_ChunkInterface)
{ {
@ -179,7 +179,7 @@ public:
return (FoundFrameXP && FoundFrameXM); 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) bool FindPortalSliceZ(int X, int Y, int Z1, int Z2, int MaxY, cChunkInterface & a_ChunkInterface)
{ {
Dir = 2; Dir = 2;

View File

@ -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 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); NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08);
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);

View File

@ -108,7 +108,7 @@ private:
case E_BLOCK_ENCHANTMENT_TABLE: case E_BLOCK_ENCHANTMENT_TABLE:
case E_BLOCK_END_PORTAL: case E_BLOCK_END_PORTAL:
case E_BLOCK_END_PORTAL_FRAME: 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_FURNACE:
case E_BLOCK_LIT_FURNACE: case E_BLOCK_LIT_FURNACE:
case E_BLOCK_INVERTED_DAYLIGHT_SENSOR: case E_BLOCK_INVERTED_DAYLIGHT_SENSOR:

View File

@ -502,11 +502,11 @@ public:
// Save powered rail flag. // Save powered rail flag.
NIBBLETYPE OtherMeta = a_Meta & 0x08; NIBBLETYPE OtherMeta = a_Meta & 0x08;
// Rotates according to table; 0x07 == 0111. // 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) switch (a_Meta & 0x07)
{ {
case 0x00: return 0x01 + OtherMeta; // North/South -> East/West case 0x00: return 0x01 + OtherMeta; // North / South -> East / West
case 0x01: return 0x00 + OtherMeta; // East/West -> North/South case 0x01: return 0x00 + OtherMeta; // East / West -> North / South
case 0x02: return 0x04 + OtherMeta; // Asc. East -> Asc. North case 0x02: return 0x04 + OtherMeta; // Asc. East -> Asc. North
case 0x04: return 0x03 + OtherMeta; // Asc. North -> Asc. West case 0x04: return 0x03 + OtherMeta; // Asc. North -> Asc. West
@ -538,11 +538,11 @@ public:
// Save powered rail flag. // Save powered rail flag.
NIBBLETYPE OtherMeta = a_Meta & 0x08; NIBBLETYPE OtherMeta = a_Meta & 0x08;
// Rotates according to table; 0x07 == 0111. // 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) switch (a_Meta & 0x07)
{ {
case 0x00: return 0x01 + OtherMeta; // North/South -> East/West case 0x00: return 0x01 + OtherMeta; // North / South -> East / West
case 0x01: return 0x00 + OtherMeta; // East/West -> North/South case 0x01: return 0x00 + OtherMeta; // East / West -> North / South
case 0x02: return 0x05 + OtherMeta; // Asc. East -> Asc. South case 0x02: return 0x05 + OtherMeta; // Asc. East -> Asc. South
case 0x05: return 0x03 + OtherMeta; // Asc. South -> Asc. West case 0x05: return 0x03 + OtherMeta; // Asc. South -> Asc. West
@ -574,7 +574,7 @@ public:
// Save powered rail flag. // Save powered rail flag.
NIBBLETYPE OtherMeta = a_Meta & 0x08; NIBBLETYPE OtherMeta = a_Meta & 0x08;
// Mirrors according to table; 0x07 == 0111. // 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) switch (a_Meta & 0x07)
{ {
case 0x05: return 0x04 + OtherMeta; // Asc. South -> Asc. North case 0x05: return 0x04 + OtherMeta; // Asc. South -> Asc. North
@ -605,7 +605,7 @@ public:
// Save powered rail flag. // Save powered rail flag.
NIBBLETYPE OtherMeta = a_Meta & 0x08; NIBBLETYPE OtherMeta = a_Meta & 0x08;
// Mirrors according to table; 0x07 == 0111. // 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) switch (a_Meta & 0x07)
{ {
case 0x02: return 0x03 + OtherMeta; // Asc. East -> Asc. West case 0x02: return 0x03 + OtherMeta; // Asc. East -> Asc. West

View File

@ -35,7 +35,7 @@ public:
return; 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); NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04);
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta); a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);

View File

@ -57,10 +57,10 @@ public:
/// Returns true if a boundingbox specified by a_Min and a_Max is inside this bounding box /// 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); 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); 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); 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 /** Returns true if this bounding box is intersected by the line specified by its two points

View File

@ -149,6 +149,39 @@ local g_ViolationPatterns =
-- No space before a closing parenthesis: -- No space before a closing parenthesis:
{" %)", "Remove the space before \")\""}, {" %)", "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 *"},
{"^[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 &"},
-- 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 *'"},
} }

View File

@ -472,26 +472,26 @@ void cChunk::Stay(bool a_Stay)
void cChunk::CollectMobCensus(cMobCensus& toFill) void cChunk::CollectMobCensus(cMobCensus & toFill)
{ {
toFill.CollectSpawnableChunk(*this); toFill.CollectSpawnableChunk(*this);
std::list<const Vector3d*> playerPositions; std::list<const Vector3d *> playerPositions;
cPlayer* currentPlayer; cPlayer * currentPlayer;
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr) for (auto itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr)
{ {
currentPlayer = (*itr)->GetPlayer(); currentPlayer = (*itr)->GetPlayer();
playerPositions.push_back(&(currentPlayer->GetPosition())); playerPositions.push_back(&(currentPlayer->GetPosition()));
} }
Vector3d currentPosition; 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()); // LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass());
if ((*itr)->IsMob()) if ((*itr)->IsMob())
{ {
cMonster& Monster = (cMonster&)(**itr); auto & Monster = reinterpret_cast<cMonster &>(**itr);
currentPosition = Monster.GetPosition(); currentPosition = Monster.GetPosition();
for (std::list<const Vector3d*>::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()); 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; int CenterX, CenterY, CenterZ;
GetRandomBlockCoords(CenterX, CenterY, CenterZ); GetRandomBlockCoords(CenterX, CenterY, CenterZ);
@ -737,7 +737,7 @@ void cChunk::ProcessQueuedSetBlocks(void)
{ {
if (GetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ) == itr->m_PreviousType) 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) // 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 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); itr = m_SetBlockQueue.erase(itr);
@ -751,7 +751,7 @@ void cChunk::ProcessQueuedSetBlocks(void)
} }
else 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); SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta);
itr = m_SetBlockQueue.erase(itr); itr = m_SetBlockQueue.erase(itr);
LOGD("Successfully set queued block - previous type ignored"); 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: case E_BLOCK_FARMLAND:
{ {
// DEBUG: This is here to catch FS #349 - melons growing over other crops. // 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(BlockType[CheckType]).c_str(),
ItemTypeToString(Soil).c_str() ItemTypeToString(Soil).c_str()
); );
@ -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(); MarkDirty();
m_BlockEntities.remove(a_BlockEntity); m_BlockEntities.remove(a_BlockEntity);

View File

@ -155,10 +155,10 @@ public:
void Stay(bool a_Stay = true); void Stay(bool a_Stay = true);
/** Recence all mobs proximities to players in order to know what to do with them */ /** 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 */ /** Try to Spawn Monsters inside chunk */
void SpawnMobs(cMobSpawner& a_MobSpawner); void SpawnMobs(cMobSpawner & a_MobSpawner);
void Tick(std::chrono::milliseconds a_Dt); void Tick(std::chrono::milliseconds a_Dt);

View File

@ -65,7 +65,7 @@ cChunkMap::~cChunkMap()
void cChunkMap::RemoveLayer( cChunkLayer* a_Layer) void cChunkMap::RemoveLayer(cChunkLayer * a_Layer)
{ {
cCSLock Lock(m_CSLayers); cCSLock Lock(m_CSLayers);
m_Layers.remove(a_Layer); 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); 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 } // 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); 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 } // 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++) 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++) for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
{ {

View File

@ -64,7 +64,7 @@ public:
static const int LAYER_SIZE = 32; static const int LAYER_SIZE = 32;
cChunkMap(cWorld* a_World); cChunkMap(cWorld * a_World);
~cChunkMap(); ~cChunkMap();
// Broadcast respective packets to all clients of the chunk where the event is taking place // 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 */ /** 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); 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 */ /** Make a Mob census, of all mobs, their family, their chunk and their distance to closest player */
void CollectMobCensus(cMobCensus& a_ToFill); void CollectMobCensus(cMobCensus & a_ToFill);
/** Try to Spawn Monsters inside all Chunks */ /** Try to Spawn Monsters inside all Chunks */
void SpawnMobs(cMobSpawner& a_MobSpawner); void SpawnMobs(cMobSpawner & a_MobSpawner);
void Tick(std::chrono::milliseconds a_Dt); void Tick(std::chrono::milliseconds a_Dt);
@ -433,9 +433,10 @@ private:
void UnloadUnusedChunks(void); void UnloadUnusedChunks(void);
/** Collect a mob census, of all mobs, their megatype, their chunk and their distance o closest player */ /** 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 */ /** Try to Spawn Monsters inside all Chunks */
void SpawnMobs(cMobSpawner& a_MobSpawner); void SpawnMobs(cMobSpawner & a_MobSpawner);
void Tick(std::chrono::milliseconds a_Dt); void Tick(std::chrono::milliseconds a_Dt);

View File

@ -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) sends to a specific client (QueueSendChunkTo)
Chunk data is queried using the cChunkDataCallback interface. 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. 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. because the query callbacks run with ChunkMap's CS locked.
A client may remove itself from all direct requests(QueueSendChunkTo()) by calling RemoveClient(); A client may remove itself from all direct requests(QueueSendChunkTo()) by calling RemoveClient();

View File

@ -436,7 +436,7 @@ bool cClientHandle::StreamNextChunk(void)
{ {
Vector3d Vector = Position + LookVector * cChunkDef::Width * Range; 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; int RangeX, RangeZ = 0;
cChunkDef::BlockToChunk(FloorC(Vector.x), FloorC(Vector.z), RangeX, RangeZ); cChunkDef::BlockToChunk(FloorC(Vector.x), FloorC(Vector.z), RangeX, RangeZ);
@ -454,7 +454,7 @@ bool cClientHandle::StreamNextChunk(void)
continue; continue;
} }
// If the chunk already loading/loaded -> skip // If the chunk already loading / loaded -> skip
if ( if (
(std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) || (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) ||
(std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.end()) (std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.end())
@ -492,7 +492,7 @@ bool cClientHandle::StreamNextChunk(void)
{ {
cChunkCoords Coords = *itr; cChunkCoords Coords = *itr;
// If the chunk already loading/loaded -> skip // If the chunk already loading / loaded -> skip
if ( if (
(std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) || (std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) ||
(std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.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; 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_HasStartedDigging = true;
m_LastDigBlockX = a_BlockX; m_LastDigBlockX = a_BlockX;
m_LastDigBlockY = a_BlockY; m_LastDigBlockY = a_BlockY;
@ -1201,7 +1201,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
(m_LastDigBlockZ != a_BlockZ) (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, a_BlockX, a_BlockY, a_BlockZ,
m_LastDigBlockX, m_LastDigBlockY, m_LastDigBlockZ, m_LastDigBlockX, m_LastDigBlockY, m_LastDigBlockZ,
(m_HasStartedDigging ? "True" : "False") (m_HasStartedDigging ? "True" : "False")
@ -1359,7 +1359,7 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
if (!CheckBlockInteractionsRate()) 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; return;
} }

View File

@ -391,7 +391,7 @@ private:
cPlayer * m_Player; 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 // Chunk position when the last StreamChunks() was called; used to avoid re-streaming while in the same chunk
int m_LastStreamedChunkX; int m_LastStreamedChunkX;
@ -416,7 +416,7 @@ private:
int m_BlockDigAnimY; int m_BlockDigAnimY;
int m_BlockDigAnimZ; 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; bool m_HasStartedDigging;
int m_LastDigBlockX; int m_LastDigBlockX;
int m_LastDigBlockY; int m_LastDigBlockY;

View File

@ -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) inline eBlockFace MirrorBlockFaceY(eBlockFace a_BlockFace)
{ {
switch (a_BlockFace) switch (a_BlockFace)

View File

@ -14,7 +14,7 @@
// fwd: WorldStorage/FastNBT.h // fwd: "WorldStorage/FastNBT.h"
class cFastNBTWriter; class cFastNBTWriter;
class cParsedNBT; class cParsedNBT;
@ -138,10 +138,10 @@ public:
bool operator !=(const cEnchantments & a_Other) const; 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") */ /** 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) */ /** 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: protected:
/** Maps enchantment ID -> enchantment level */ /** Maps enchantment ID -> enchantment level */

View File

@ -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; UInt32 buf;
memcpy( &buf, a_Value, sizeof( buf)); memcpy( &buf, a_Value, sizeof( buf));

View File

@ -1309,7 +1309,8 @@ bool cEntity::DetectPortal()
if (IsPlayer()) 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); 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); 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 // 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 // The latter is only changed with a relmove / teleport, and m_LastPos stores this position
m_LastPos = GetPosition(); m_LastPos = GetPosition();
} }
else else

View File

@ -474,7 +474,7 @@ protected:
static cCriticalSection m_CSCount; static cCriticalSection m_CSCount;
static UInt32 m_EntityCount; static UInt32 m_EntityCount;
/** Measured in meter/second (m/s) */ /** Measured in meters / second (m / s) */
Vector3d m_Speed; Vector3d m_Speed;
/** The ID of the entity that is guaranteed to be unique within a single run of the server. /** 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 */ /** Stores whether head yaw has been set manually */
bool m_bDirtyHead; 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; bool m_bDirtyOrientation;
/** Stores whether we have sent a Velocity packet with a speed of zero (no speed) to the client /** Stores whether we have sent a Velocity packet with a speed of zero (no speed) to the client

View File

@ -102,11 +102,11 @@ int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage)
// If potion is level II, half the duration. If not, stays the same // If potion is level II, half the duration. If not, stays the same
TierCoeff = (GetPotionEffectIntensity(a_ItemDamage) > 0) ? 0.5 : 1; 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 // Extended potion if sixth lowest bit is set
ExtCoeff = (a_ItemDamage & 0x40) ? (8.0 / 3.0) : 1; 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; SplashCoeff = IsPotionDrinkable(a_ItemDamage) ? 1 : 0.75;
// Ref.: // Ref.:

View File

@ -905,7 +905,7 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
} }
/* Check to which side the minecart is to be pushed. /* 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. 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. */ 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 ( if (
@ -954,7 +954,7 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
} }
/* Check to which side the minecart is to be pushed. /* 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. 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. */ 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 ( if (

View File

@ -29,7 +29,7 @@ public:
enum ePayload enum ePayload
{ {
mpNone = 0, // Empty minecart, ridable by player or mobs 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 mpFurnace = 2, // Minecart-with-furnace, can be powered
mpTNT = 3, // Minecart-with-TNT, can be blown up with activator rail mpTNT = 3, // Minecart-with-TNT, can be blown up with activator rail
mpHopper = 5, // Minecart-with-hopper, can be hopper 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); cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z);
/** Handles physics on normal rails /** 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); void HandleRailPhysics(NIBBLETYPE a_RailMeta, std::chrono::milliseconds a_Dt);
/** Handles powered rail physics /** Handles powered rail physics

View File

@ -355,7 +355,7 @@ float cPlayer::GetXpPercentage()
int currentLevel_XpBase = XpForLevel(currentLevel); int currentLevel_XpBase = XpForLevel(currentLevel);
return static_cast<float>(m_CurrentXp - currentLevel_XpBase) / return static_cast<float>(m_CurrentXp - currentLevel_XpBase) /
static_cast<float>(XpForLevel(1+currentLevel) - currentLevel_XpBase); static_cast<float>(XpForLevel(1 + currentLevel) - currentLevel_XpBase);
} }
@ -364,7 +364,7 @@ float cPlayer::GetXpPercentage()
bool cPlayer::SetCurrentExperience(int a_CurrentXp) bool cPlayer::SetCurrentExperience(int a_CurrentXp)
{ {
if (!(a_CurrentXp >= 0) || (a_CurrentXp > (std::numeric_limits<int>().max() - m_LifetimeTotalXp))) if (!(a_CurrentXp >= 0) || (a_CurrentXp > (std::numeric_limits<int>::max() - m_LifetimeTotalXp)))
{ {
LOGWARNING("Tried to update experiece with an invalid Xp value: %d", a_CurrentXp); LOGWARNING("Tried to update experiece with an invalid Xp value: %d", a_CurrentXp);
return false; // oops, they gave us a dodgey number 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; 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 // Set experience to be updated
m_bDirtyExperience = true; 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(); m_LastBedPos.z = root.get("SpawnZ", a_World->GetSpawnZ()).asInt();
// Load the player stats. // 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); cStatSerializer StatSerializer(cRoot::Get()->GetDefaultWorld()->GetName(), GetName(), &m_Stats);
StatSerializer.Load(); StatSerializer.Load();
@ -1868,7 +1868,7 @@ bool cPlayer::SaveToDisk()
} }
// Save the player stats. // 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); cStatSerializer StatSerializer(cRoot::Get()->GetDefaultWorld()->GetName(), GetName(), &m_Stats);
if (!StatSerializer.Save()) if (!StatSerializer.Save())
{ {
@ -2076,7 +2076,7 @@ void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos)
} }
else else
{ {
if (Value >= 25) // Ignore small/slow movement if (Value >= 25) // Ignore small / slow movement
{ {
m_Stats.AddValue(statDistFlown, Value); m_Stats.AddValue(statDistFlown, Value);
} }

View File

@ -644,7 +644,7 @@ protected:
virtual void Destroyed(void); 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; virtual bool DoTakeDamage(TakeDamageInfo & TDI) override;
/** Stops players from burning in creative mode */ /** Stops players from burning in creative mode */

View File

@ -109,7 +109,7 @@ protected:
eKind m_ProjectileKind; eKind m_ProjectileKind;
/** The structure for containing the entity ID and name who has created this projectile /** 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; CreatorData m_CreatorData;
/** True if the projectile has hit the ground and is stuck there */ /** True if the projectile has hit the ground and is stuck there */

View File

@ -237,7 +237,7 @@ bool cCaveTunnel::RefineDefPoints(const cCaveDefPoints & a_Src, cCaveDefPoints &
return true; 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; bool res = false;
size_t Num = a_Src.size() - 2; // this many intermediary points size_t Num = a_Src.size() - 2; // this many intermediary points
a_Dst.clear(); a_Dst.clear();
@ -488,7 +488,7 @@ void cCaveTunnel::ProcessChunk(
continue; 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 DifX = itr->m_BlockX - BlockStartX; // substitution for faster calc
int DifY = itr->m_BlockY; int DifY = itr->m_BlockY;
int DifZ = itr->m_BlockZ - BlockStartZ; // substitution for faster calc int DifZ = itr->m_BlockZ - BlockStartZ; // substitution for faster calc
@ -529,7 +529,7 @@ void cCaveTunnel::ProcessChunk(
/* /*
#ifdef _DEBUG #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) 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 int DifX = itr->m_BlockX - BlockStartX; // substitution for faster calc

View File

@ -209,7 +209,7 @@ void cChunkGenerator::Execute(void)
{ {
if ((NumChunksGenerated > 16) && (clock() - LastReportTick > CLOCKS_PER_SEC)) 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), (double)NumChunksGenerated * CLOCKS_PER_SEC/ (clock() - GenerationStart),
NumChunksGenerated NumChunksGenerated
); );
@ -241,7 +241,7 @@ void cChunkGenerator::Execute(void)
// Display perf info once in a while: // Display perf info once in a while:
if ((NumChunksGenerated > 16) && (clock() - LastReportTick > 2 * CLOCKS_PER_SEC)) 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), (double)NumChunksGenerated * CLOCKS_PER_SEC / (clock() - GenerationStart),
NumChunksGenerated NumChunksGenerated
); );

View File

@ -195,7 +195,7 @@ void cFinishGenGlowStone::GenFinish(cChunkDesc & a_ChunkDesc)
// The maximum size for a string of glowstone can get 3 - 5 blocks long // The maximum size for a string of glowstone can get 3 - 5 blocks long
int Size = 3 + m_Noise.IntNoise3DInt(ChunkX, i, ChunkZ) % 3; 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 X = Size + (m_Noise.IntNoise2DInt(i, Size) % (cChunkDef::Width - Size * 2));
int Z = Size + (m_Noise.IntNoise2DInt(X, i) % (cChunkDef::Width - Size * 2)); int Z = Size + (m_Noise.IntNoise2DInt(X, i) % (cChunkDef::Width - Size * 2));

View File

@ -667,7 +667,7 @@ public:
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) 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]; cChunkDef::BiomeMap neighborBiomes[3][3];
for (int z = 0; z < 3; z++) for (int x = 0; x < 3; x++) for (int z = 0; z < 3; z++) for (int x = 0; x < 3; x++)
{ {

View File

@ -5,7 +5,7 @@
/* /*
The integers generated may be interpreted in several ways: The integers generated may be interpreted in several ways:
- land/see designators - land / sea designators
- 0 = ocean - 0 = ocean
- >0 = land - >0 = land
- biome group - 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) for (int z = 0; z < SizeZ; ++z)
{ {
memcpy(a_Values + z * SizeX, cache + (z + (a_MinZ & 1)) * lowStepX + (a_MinX & 1), SizeX * sizeof(int)); memcpy(a_Values + z * SizeX, cache + (z + (a_MinZ & 1)) * lowStepX + (a_MinX & 1), SizeX * sizeof(int));

View File

@ -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) 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]; cChunkDef::BiomeMap neighborBiomes[3 * 3];
for (int z = 0; z < 3; z++) for (int z = 0; z < 3; z++)
{ {

View File

@ -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) 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)); memcpy(a_Values + z * a_SizeX, cache + (z + (a_MinZ & 1)) * lowStepX + (a_MinX & 1), a_SizeX * sizeof(int));

View File

@ -61,7 +61,7 @@ protected:
/** The noise used as a pseudo-random generator */ /** The noise used as a pseudo-random generator */
cNoise m_Noise; 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; int m_MaxSize;
/** Borders of the vilalge - no item may reach out of this cuboid. */ /** Borders of the vilalge - no item may reach out of this cuboid. */

View File

@ -34,7 +34,7 @@ protected:
/** Maximum depth of the generator tree*/ /** Maximum depth of the generator tree*/
int m_MaxDepth; 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; int m_MaxSize;

View File

@ -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) 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; 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 // 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; 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 size_t Num = a_Src.size() - 2; // this many intermediary points
a_Dst.clear(); a_Dst.clear();
a_Dst.reserve(Num * 2 + 2); a_Dst.reserve(Num * 2 + 2);

View File

@ -311,7 +311,7 @@ void cStructGenOreNests::GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_Ore
rnd /= cChunkDef::Width; rnd /= cChunkDef::Width;
int BaseY = rnd % a_MaxHeight; int BaseY = rnd % a_MaxHeight;
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; int Num = 0;
while (Num < NestSize) while (Num < NestSize)
{ {

View File

@ -61,7 +61,7 @@ protected:
/** The noise used as a pseudo-random generator */ /** The noise used as a pseudo-random generator */
cNoise m_Noise; 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; int m_MaxSize;
/** Borders of the structure - no item may reach out of this cuboid. */ /** Borders of the structure - no item may reach out of this cuboid. */

View File

@ -31,10 +31,10 @@ protected:
/** The noise used for generating random numbers */ /** The noise used for generating random numbers */
cNoise m_Noise; cNoise m_Noise;
/** Maximum depth of the generator tree*/ /** Maximum depth of the generator tree */
int m_MaxDepth; 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; int m_MaxSize;

View File

@ -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); PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
h--; 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++) 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); 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); PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
h--; 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++) 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); PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);

View File

@ -61,7 +61,7 @@ protected:
/** The noise used as a pseudo-random generator */ /** The noise used as a pseudo-random generator */
cNoise m_Noise; 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; int m_MaxSize;
/** Borders of the vilalge - no item may reach out of this cuboid. */ /** Borders of the vilalge - no item may reach out of this cuboid. */

View File

@ -34,7 +34,7 @@ protected:
/** Maximum depth of the generator tree*/ /** Maximum depth of the generator tree*/
int m_MaxDepth; 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; int m_MaxSize;
/** The underlying biome generator that defines whether the base is created or not */ /** The underlying biome generator that defines whether the base is created or not */

View File

@ -162,7 +162,7 @@ protected:
/** The noise used as a pseudo-random generator */ /** The noise used as a pseudo-random generator */
cNoise m_Noise; 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; int m_MaxSize;
/** The density for this village. Used to refrain from populating all house connectors. Range [0, 100] */ /** The density for this village. Used to refrain from populating all house connectors. Range [0, 100] */

View File

@ -32,7 +32,7 @@ protected:
/** Maximum depth of the generator tree*/ /** Maximum depth of the generator tree*/
int m_MaxDepth; 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; int m_MaxSize;
/** Minimum density - percentage of allowed house connections. Range [0, 100] */ /** Minimum density - percentage of allowed house connections. Range [0, 100] */

View File

@ -18,9 +18,9 @@
// Useful warnings from warning level 4: // Useful warnings from warning level 4:
#pragma warning(3 : 4189) // Local variable is initialized but not referenced #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 : 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 : 4505) // Unreferenced local function has been removed
#pragma warning(3 : 4701) // Potentially unitialized local variable used #pragma warning(3 : 4701) // Potentially unitialized local variable used
#pragma warning(3 : 4702) // Unreachable code #pragma warning(3 : 4702) // Unreachable code

View File

@ -61,7 +61,7 @@ public:
AString m_LastValue; 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); void NotifyLast(void);
/** Parses one line of header data. Returns true if successful */ /** Parses one line of header data. Returns true if successful */

View File

@ -202,7 +202,7 @@ size_t cHTTPRequest::ParseRequestLine(const char * a_Data, size_t a_Size)
m_IsValid = false; m_IsValid = false;
return AString::npos; 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) if (strncmp(m_IncomingHeaderData.c_str() + URLEnd + 1, "HTTP/1.", 7) != 0)
{ {
m_IsValid = false; m_IsValid = false;

View File

@ -1,11 +1,11 @@
// IniFile.cpp: Implementation of the CIniFile class. // IniFile.cpp: Implementation of the CIniFile class.
// Written by: Adam Clauss // Written by: Adam Clauss
// Email: cabadam@houston.rr.com // 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. // email suggested changes to me.
// //
// Rewritten by: Shane Hill // Rewritten by: Shane Hill
// Date: 21/08/2001 // Date: 2001-08-21
// Email: Shane.Hill@dsto.defence.gov.au // Email: Shane.Hill@dsto.defence.gov.au
// Reason: Remove dependancy on MFC. Code should compile on any // Reason: Remove dependancy on MFC. Code should compile on any
// platform. // platform.

View File

@ -1,14 +1,14 @@
// IniFile.cpp: Implementation of the CIniFile class. // IniFile.cpp: Implementation of the CIniFile class.
// Written by: Adam Clauss // Written by: Adam Clauss
// Email: cabadam@tamu.edu // 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. // email suggested changes to me.
// //
// Rewritten by: Shane Hill // Rewritten by: Shane Hill
// Date: 21/08/2001 // Date: 2001-08-21
// Email: Shane.Hill@dsto.defence.gov.au // Email: Shane.Hill@dsto.defence.gov.au
// Reason: Remove dependancy on MFC. Code should compile on any // 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 =. // Gets value of [keyname] valuename =.
// Overloaded to return string, int, and double. // 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 AString & keyname, const AString & valuename, const AString & defValue = "") const;
AString GetValue (const int keyID, const int valueID, 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; 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 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. 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. */ If there is none of the three values or they are all empty, the default is used and stored in the Ports value. */

View File

@ -499,7 +499,7 @@ int cInventory::ArmorSlotNumToEntityEquipmentID(short a_ArmorSlotNum)
#if 0 #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 // Fill already present stacks
if (a_Mode < 2) if (a_Mode < 2)

View File

@ -171,7 +171,7 @@ public:
bool LoadFromJson(Json::Value & a_Value); bool LoadFromJson(Json::Value & a_Value);
protected: 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_ArmorSlots;
cItemGrid m_InventorySlots; cItemGrid m_InventorySlots;

View File

@ -78,7 +78,7 @@ public:
!BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision(&a_Player, PlaceMeta) !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 // Happens when you place a block aiming at side of block with a torch on it or stem beside it
return false; return false;
} }

View File

@ -362,7 +362,7 @@ bool cItemHandler::OnPlayerPlace(
!BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision(&a_Player, PlaceMeta) !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 // Happens when you place a block aiming at side of block with a torch on it or stem beside it
return false; return false;
} }

View File

@ -64,7 +64,7 @@ public:
} }
default: 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); AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height)) if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height))
{ {

View File

@ -71,7 +71,7 @@ public:
cBlockInfo::FullyOccupiesVoxel(a_CBBlockType) cBlockInfo::FullyOccupiesVoxel(a_CBBlockType)
) )
{ {
// Can't place lilypad on air/in another block! // Can't place lilypad on air / in another block!
return true; return true;
} }
m_HasHitFluid = true; m_HasHitFluid = true;

View File

@ -46,10 +46,10 @@ private:
extern void LOG(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 LOGINFO (const char * a_Format, ...) FORMATSTRING(1, 2);
extern void LOGWARN(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 LOGERROR(const char * a_Format, ...) FORMATSTRING(1, 2);

View File

@ -591,7 +591,7 @@ void cMap::SendTo(cClientHandle & a_Client)
for (unsigned int i = 0; i < m_Width; ++i) 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); a_Client.SendMapColumn(m_ID, i, 0, Colors, m_Height, m_Scale);
} }

View File

@ -140,7 +140,7 @@ public:
/** Update a circular region around the specified player. */ /** Update a circular region around the specified player. */
void UpdateRadius(cPlayer & a_Player, unsigned int a_Radius); 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); void UpdateClient(cPlayer * a_Player);
// tolua_begin // tolua_begin

View File

@ -19,8 +19,8 @@ void cMobCensus::CollectMob(cMonster & a_Monster, cChunk & a_Chunk, double a_Dis
bool cMobCensus::IsCapped(cMonster::eFamily a_MobFamily) 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 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 // 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 // MG TODO : code the correct count
if ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio >= m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily)) if ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio >= m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily))
{ {

View File

@ -32,8 +32,8 @@ public:
// MG TODO : code the correct rule (not loaded chunk but short distant from players) // MG TODO : code the correct rule (not loaded chunk but short distant from players)
void CollectSpawnableChunk(cChunk & a_Chunk); void CollectSpawnableChunk(cChunk & a_Chunk);
/// Collect a mob - it's distance to player, it's family ... /// Collect a mob - its distance to player, its family ...
void CollectMob(cMonster& a_Monster, cChunk& a_Chunk, double a_Distance); 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) /// Returns true if the family is capped (i.e. there are more mobs of this family than max)
bool IsCapped(cMonster::eFamily a_MobFamily); bool IsCapped(cMonster::eFamily a_MobFamily);

View File

@ -6,7 +6,11 @@
#include "Entities/Entity.h" #include "Entities/Entity.h"
#include "Chunk.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); // LOGD("Collecting monster %s, with distance %f", a_Monster->GetClass(), a_Distance);
tMonsterToDistance::iterator it = m_MonsterToDistance.find(&a_Monster); tMonsterToDistance::iterator it = m_MonsterToDistance.find(&a_Monster);

View File

@ -16,19 +16,19 @@ protected :
// structs used for later maps (see m_MonsterToDistance and m_DistanceToMonster) // structs used for later maps (see m_MonsterToDistance and m_DistanceToMonster)
struct sDistanceAndChunk 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; double m_Distance;
cChunk* m_Chunk; cChunk * m_Chunk;
}; };
struct sMonsterAndChunk struct sMonsterAndChunk
{ {
sMonsterAndChunk(cEntity& a_Monster, cChunk& a_Chunk) : m_Monster(a_Monster), m_Chunk(a_Chunk) {} sMonsterAndChunk(cEntity & a_Monster, cChunk & a_Chunk) : m_Monster(a_Monster), m_Chunk(a_Chunk) {}
cEntity& m_Monster; cEntity & m_Monster;
cChunk& m_Chunk; cChunk & m_Chunk;
}; };
public : public :
typedef std::map<cEntity*, sDistanceAndChunk> tMonsterToDistance; typedef std::map<cEntity *, sDistanceAndChunk> tMonsterToDistance;
typedef std::multimap<double, sMonsterAndChunk> tDistanceToMonster; typedef std::multimap<double, sMonsterAndChunk> tDistanceToMonster;
protected : protected :
@ -50,7 +50,7 @@ public :
// count a mob on a specified chunk with specified distance to an unkown player // 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 // 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) // 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 // 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 // that means that if a mob is 30 m from a player and 150 m from another one. It will be

View File

@ -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) if (m_NewPack)
{ {
m_MobType = ChooseMobType(a_Biome); m_MobType = ChooseMobType(a_Biome);

View File

@ -39,7 +39,7 @@ public :
// if this is the first of a Pack : determine the type of monster // 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 // 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 // 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 // mark the beginning of a new Pack
// all mobs of the same Pack are the same type // all mobs of the same Pack are the same type

View File

@ -224,7 +224,7 @@ protected:
Calls ResetPathFinding and sets m_IsFollowingPath to false */ Calls ResetPathFinding and sets m_IsFollowingPath to false */
void StopMovingToPosition(); 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); void SetPitchAndYawFromDestination(void);
virtual void HandleFalling(void); virtual void HandleFalling(void);

View File

@ -12,7 +12,7 @@ Put this in your .cpp:
*/ */
#ifdef COMPILING_PATHFIND_DEBUGGER #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. */ this class outside of MCServer. This preprocessor flag is never set when compiling MCServer. */
#include "PathFinderIrrlicht_Head.h" #include "PathFinderIrrlicht_Head.h"
#endif #endif

View File

@ -23,7 +23,7 @@ public:
private: private:
struct sAttributesStruct; struct sAttributesStruct;
struct sMonsterConfigState; struct sMonsterConfigState;
sMonsterConfigState* m_pState; sMonsterConfigState * m_pState;
void Initialize(); void Initialize();
} ; } ;

View File

@ -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 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 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 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 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 x1interp4 = CubicInterpolate(points1[3][0], points1[3][1], points1[3][2], points1[3][3], FracX);
const NOISE_DATATYPE points2[4][4] = 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), }, { 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 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 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 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 x2interp4 = CubicInterpolate(points2[3][0], points2[3][1], points2[3][2], points2[3][3], FracX);
const NOISE_DATATYPE points3[4][4] = 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 - 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, 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 + 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 + 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 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 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 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 x3interp4 = CubicInterpolate(points3[3][0], points3[3][1], points3[3][2], points3[3][3], FracX);
const NOISE_DATATYPE points4[4][4] = 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 - 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, 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 + 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 + 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 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 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 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 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 FracY = (a_Y) - BaseY;
const NOISE_DATATYPE yinterp1 = CubicInterpolate( x1interp1, x1interp2, x1interp3, x1interp4, FracY); const NOISE_DATATYPE yinterp1 = CubicInterpolate(x1interp1, x1interp2, x1interp3, x1interp4, FracY);
const NOISE_DATATYPE yinterp2 = CubicInterpolate( x2interp1, x2interp2, x2interp3, x2interp4, FracY); const NOISE_DATATYPE yinterp2 = CubicInterpolate(x2interp1, x2interp2, x2interp3, x2interp4, FracY);
const NOISE_DATATYPE yinterp3 = CubicInterpolate( x3interp1, x3interp2, x3interp3, x3interp4, FracY); const NOISE_DATATYPE yinterp3 = CubicInterpolate(x3interp1, x3interp2, x3interp3, x3interp4, FracY);
const NOISE_DATATYPE yinterp4 = CubicInterpolate( x4interp1, x4interp2, x4interp3, x4interp4, FracY); const NOISE_DATATYPE yinterp4 = CubicInterpolate(x4interp1, x4interp2, x4interp3, x4interp4, FracY);
const NOISE_DATATYPE FracZ = (a_Z) - BaseZ; const NOISE_DATATYPE FracZ = (a_Z) - BaseZ;
return CubicInterpolate( yinterp1, yinterp2, yinterp3, yinterp4, FracZ); return CubicInterpolate(yinterp1, yinterp2, yinterp3, yinterp4, FracZ);
} }

View File

@ -13,7 +13,7 @@ public:
void Lock(void); void Lock(void);
void Unlock(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 // The fake versions (in Release) will not effect the program in any way
#ifdef _DEBUG #ifdef _DEBUG
cCriticalSection(void); cCriticalSection(void);

View File

@ -62,7 +62,7 @@ public:
{ {
fmRead, // Read-only. If the file doesn't exist, object will not be valid 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 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 fmAppend // Write-only. If the file already exists cursor will be moved to the end of the file
} ; } ;

View File

@ -162,7 +162,7 @@ public:
/** Returns the local port to which the underlying socket is bound. */ /** Returns the local port to which the underlying socket is bound. */
virtual UInt16 GetPort(void) const = 0; 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. */ 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; virtual bool Send(const AString & a_Payload, const AString & a_Host, UInt16 a_Port) = 0;

View File

@ -9,7 +9,7 @@ public:
void Wait(); void Wait();
void Signal(); void Signal();
private: private:
void* m_Handle; // HANDLE pointer void * m_Handle; // HANDLE pointer
#ifndef _WIN32 #ifndef _WIN32
bool m_bNamed; bool m_bNamed;

View File

@ -68,7 +68,7 @@ const AString & cChunkDataSerializer::Serialize(int a_Version, int a_ChunkX, int
void cChunkDataSerializer::Serialize29(AString & a_Data) 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 BiomeDataSize = cChunkDef::Width * cChunkDef::Width;
const int MetadataOffset = sizeof(m_BlockTypes); const int MetadataOffset = sizeof(m_BlockTypes);
@ -126,7 +126,7 @@ void cChunkDataSerializer::Serialize29(AString & a_Data)
void cChunkDataSerializer::Serialize39(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 BiomeDataSize = cChunkDef::Width * cChunkDef::Width;
const int MetadataOffset = sizeof(m_BlockTypes); const int MetadataOffset = sizeof(m_BlockTypes);

View File

@ -667,7 +667,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery)
Request += "User-Agent: MCServer\r\n"; Request += "User-Agent: MCServer\r\n";
Request += "Connection: close\r\n"; Request += "Connection: close\r\n";
Request += "Content-Type: application/json\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<unsigned>(RequestBody.length()));
Request += "\r\n"; Request += "\r\n";
Request += RequestBody; Request += RequestBody;

View File

@ -492,7 +492,7 @@ void cProtocol172::SendEntityVelocity(const cEntity & a_Entity)
cPacketizer Pkt(*this, 0x12); // Entity Velocity packet cPacketizer Pkt(*this, 0x12); // Entity Velocity packet
Pkt.WriteBEUInt32(a_Entity.GetUniqueID()); 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<short>(a_Entity.GetSpeedX() * 400)); Pkt.WriteBEInt16(static_cast<short>(a_Entity.GetSpeedX() * 400));
Pkt.WriteBEInt16(static_cast<short>(a_Entity.GetSpeedY() * 400)); Pkt.WriteBEInt16(static_cast<short>(a_Entity.GetSpeedY() * 400));
Pkt.WriteBEInt16(static_cast<short>(a_Entity.GetSpeedZ() * 400)); Pkt.WriteBEInt16(static_cast<short>(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 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; a_Item.m_Lore = Lore;

View File

@ -479,7 +479,7 @@ void cProtocol180::SendEntityVelocity(const cEntity & a_Entity)
cPacketizer Pkt(*this, 0x12); // Entity Velocity packet cPacketizer Pkt(*this, 0x12); // Entity Velocity packet
Pkt.WriteVarInt32(a_Entity.GetUniqueID()); 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.GetSpeedX() * 400));
Pkt.WriteBEInt16((short)(a_Entity.GetSpeedY() * 400)); Pkt.WriteBEInt16((short)(a_Entity.GetSpeedY() * 400));
Pkt.WriteBEInt16((short)(a_Entity.GetSpeedZ() * 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 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; a_Item.m_Lore = Lore;

View File

@ -2153,7 +2153,7 @@ void cRankManager::ClearPlayerRanks(void)
} }
catch (SQLite::Exception & ex) 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());
} }
} }

View File

@ -311,8 +311,8 @@ void cRoot::LoadWorlds(cIniFile & IniFile)
continue; continue;
} }
FoundAdditionalWorlds = true; FoundAdditionalWorlds = true;
cWorld* NewWorld = new cWorld( WorldName.c_str()); cWorld * NewWorld = new cWorld(WorldName.c_str());
m_WorldsByName[ WorldName ] = NewWorld; m_WorldsByName[WorldName] = NewWorld;
} // for i - Worlds } // for i - Worlds
if (!FoundAdditionalWorlds) if (!FoundAdditionalWorlds)

View File

@ -218,7 +218,7 @@ private:
/// Does the actual work of executing a command /// Does the actual work of executing a command
void DoExecuteConsoleCommand(const AString & a_Cmd); void DoExecuteConsoleCommand(const AString & a_Cmd);
static cRoot* s_Root; static cRoot * s_Root;
static void InputThread(cRoot & a_Params); static void InputThread(cRoot & a_Params);
}; // tolua_export }; // tolua_export

View File

@ -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); 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); 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); 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); cCSLock Lock(m_CSTeams);

View File

@ -262,19 +262,16 @@ public:
cTeam * QueryPlayerTeam(const AString & a_Name); // WARNING: O(n logn) cTeam * QueryPlayerTeam(const AString & a_Name); // WARNING: O(n logn)
/** Execute callback for each objective with the specified type /** Execute callback for each objective with the specified type
Returns true if all objectives processed, false if the callback aborted by returning true. Returns true if all objectives processed, false if the callback aborted by returning true. */
*/ bool ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback & a_Callback);
bool ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback);
/** Execute callback for each objective. /** Execute callback for each objective.
Returns true if all objectives have been processed, false if the callback aborted by returning true. 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
bool ForEachObjective(cObjectiveCallback& a_Callback); // Exported in ManualBindings.cpp
/** Execute callback for each team. /** Execute callback for each team.
Returns true if all teams have been processed, false if the callback aborted by returning true. 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
bool ForEachTeam(cTeamCallback& a_Callback); // Exported in ManualBindings.cpp
void SetDisplay(cObjective * a_Objective, eDisplaySlot a_Slot); void SetDisplay(cObjective * a_Objective, eDisplaySlot a_Slot);

View File

@ -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. */ /** 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); 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. */ 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); bool HardenBlock(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta);

View File

@ -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 (i + 1 < ARRAYCOUNT(gCrossCoords)) // Sides of torch, not top (top is last)
{ {
if ( 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 (!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) if ((OtherRepeaterDir & 0x03) == 0x3)
{ {
return true; 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 // 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) if ((OtherRepeaterDir & 0x03) == 0x1)
{ {
return true; return true;
} // If so, I am latched/locked } // If so, I am latched / locked
} }
break; break;
@ -1634,7 +1634,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB
if ((OtherRepeaterDir & 0x30) == 0x00) if ((OtherRepeaterDir & 0x30) == 0x00)
{ {
return true; 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 // 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) if ((OtherRepeaterDir & 0x03) == 0x02)
{ {
return true; return true;
} // If so, I am latched/locked } // If so, I am latched / locked
} }
break; break;

View File

@ -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()]. */ /** 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); 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 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. */ /** Converts a stream of BE shorts into UTF-8 string; returns a_UTF8. */

View File

@ -64,8 +64,9 @@ private:
int GetHitNormal( const Vector3f & start, const Vector3f & end, const Vector3i & a_BlockPos); int GetHitNormal( const Vector3f & start, const Vector3f & end, const Vector3i & a_BlockPos);
/// Signum function /// Signum function
int SigNum( float a_Num); int SigNum(float a_Num);
cWorld* m_World;
cWorld * m_World;
static const std::array<const Vector3f, 6> & m_NormalTable(void); static const std::array<const Vector3f, 6> & m_NormalTable(void);

View File

@ -1,7 +1,7 @@
// DropSpenserWindow.cpp // DropSpenserWindow.cpp
// Representing the UI window for the dropper/dispenser block // Representing the UI window for the dropper / dispenser block
#include "Globals.h" #include "Globals.h"
#include "DropSpenserWindow.h" #include "DropSpenserWindow.h"

View File

@ -1,7 +1,7 @@
// DropSpenserWindow.h // DropSpenserWindow.h
// Representing the UI window for the dropper/dispenser block // Representing the UI window for the dropper / dispenser block

View File

@ -41,7 +41,7 @@ void cFurnaceWindow::DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer &
} }
else else
{ {
// Furnace Input/Fuel Slot // Furnace Input / Fuel Slot
AreasInOrder.push_back(m_SlotAreas[1]); /* Inventory */ AreasInOrder.push_back(m_SlotAreas[1]); /* Inventory */
AreasInOrder.push_back(m_SlotAreas[2]); /* Hotbar */ AreasInOrder.push_back(m_SlotAreas[2]); /* Hotbar */
super::DistributeStackToAreas(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, false); super::DistributeStackToAreas(a_ItemStack, a_Player, AreasInOrder, a_ShouldApply, false);

View File

@ -33,7 +33,7 @@ public:
a_ChestCart->GetWorld()->BroadcastSoundEffect("random.chestopen", a_ChestCart->GetPosX(), a_ChestCart->GetPosY(), a_ChestCart->GetPosZ(), 1, 1); 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; cSlotAreas AreasInOrder;

View File

@ -306,7 +306,7 @@ public:
void UpdateResult(cPlayer & a_Player); void UpdateResult(cPlayer & a_Player);
protected: protected:
/** The maximum cost of repairing/renaming in the anvil. */ /** The maximum cost of repairing / renaming in the anvil. */
int m_MaximumCost; int m_MaximumCost;
/** The stack size of the second item where was used for repair */ /** The stack size of the second item where was used for repair */

View File

@ -59,7 +59,7 @@ protected:
cNoise m_Noise2; cNoise m_Noise2;
cNoise m_Noise3; 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; int m_CellSize;
/** The amount that the cell seeds may be offset from the grid. /** The amount that the cell seeds may be offset from the grid.

View File

@ -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, "/")); return GetBaseURL(StringSplit(a_URL, "/"));
} }

View File

@ -176,7 +176,7 @@ protected:
{ {
float PercentDone = static_cast<float>(m_NumPrepared * 100) / m_MaxIdx; float PercentDone = static_cast<float>(m_NumPrepared * 100) / m_MaxIdx;
float ChunkSpeed = static_cast<float>((m_NumPrepared - m_LastReportChunkCount) * 1000) / std::chrono::duration_cast<std::chrono::milliseconds>(Now - m_LastReportTime).count(); float ChunkSpeed = static_cast<float>((m_NumPrepared - m_LastReportChunkCount) * 1000) / std::chrono::duration_cast<std::chrono::milliseconds>(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_World.GetName().c_str(), PercentDone, m_NumPrepared, m_MaxIdx, ChunkSpeed
); );
m_LastReportTime = Now; m_LastReportTime = Now;
@ -767,7 +767,7 @@ eWeather cWorld::ChooseNewWeather()
case eWeather_Rain: 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; return ((m_TickRand.randInt() % 256) < 32) ? eWeather_ThunderStorm : eWeather_Sunny;
} }
} }
@ -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); return m_ChunkMap->DoWithBeaconAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback);
} }

Some files were not shown because too many files have changed in this diff Show More