1
0

Merge remote-tracking branch 'origin/master' into warnings

Conflicts:
	src/Mobs/Monster.cpp
	src/Vector3.h
This commit is contained in:
Tiger Wang 2015-05-10 12:16:20 +01:00
commit 9c490293b8
120 changed files with 361 additions and 306 deletions

View File

@ -8,8 +8,8 @@ Here are the conventions:
* We use the subset of C++11 supported by MSVC 2013 (ask if you think that something would be useful)
* All new public functions in all classes need documenting comments on what they do and what behavior they follow, use doxy-comments formatted as `/** Description */`. Do not use asterisks on additional lines in multi-line comments.
* Use spaces after the comment markers: `// Comment` instead of `//Comment`. A comment must be prefixed with two spaces if it's on the same line with code:
- `SomeFunction() // Note the two spaces prefixed to me and the space after the slashes.`
* All variable names and function names use CamelCase style.
- `SomeFunction()<Space><Space>//<Space>Note the two spaces prefixed to me and the space after the slashes.`
* All variable names and function names use CamelCase style, with the exception of single letter variables.
- `ThisIsAProperFunction()` `This_is_bad()` `this_is_bad` `GoodVariableName` `badVariableName`.
* All member variables start with `m_`, all function parameters start with `a_`, all class names start with `c`.
- `class cMonster { int m_Health; int DecreaseHealth(int a_Amount); }`

View File

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

View File

@ -159,7 +159,7 @@ void cLuaWindow::Destroy(void)
m_Plugin->Unreference(m_LuaRef);
}
// Lua will take care of this object, it will garbage-collect it, so we *must not* delete it!
// Lua will take care of this object, it will garbage-collect it, so we must not delete it!
m_IsDestroyed = false;
}
@ -167,10 +167,10 @@ void cLuaWindow::Destroy(void)
void cLuaWindow::DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer& a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply)
void cLuaWindow::DistributeStack(cItem & a_ItemStack, int a_Slot, cPlayer & a_Player, cSlotArea * a_ClickedArea, bool a_ShouldApply)
{
cSlotAreas Areas;
for (auto Area : m_SlotAreas)
for (auto && Area : m_SlotAreas)
{
if (Area != a_ClickedArea)
{

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

View File

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

View File

@ -1,7 +1,7 @@
// MobHeadEntity.cpp
// Implements the cMobHeadEntity class representing a single skull/head in the world
// Implements the cMobHeadEntity class representing a single skull / head in the world
#include "Globals.h"
#include "MobHeadEntity.h"

View File

@ -1,6 +1,6 @@
// MobHeadEntity.h
// Declares the cMobHeadEntity class representing a single skull/head in the world
// Declares the cMobHeadEntity class representing a single skull / head in the world

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
{
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
Meta ^= 0x04; // Toggle 3rd (addition/subtraction) bit with XOR
Meta ^= 0x04; // Toggle 3rd (addition / subtraction) bit with XOR
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);
}

View File

@ -134,7 +134,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta)
return a_Meta;
}
// Holds open/closed meta data. 0x0C == 1100.
// Holds open / closed meta data. 0x0C == 1100.
NIBBLETYPE OtherMeta = a_Meta & 0x0C;
// Mirrors according to a table. 0x03 == 0011.
@ -152,7 +152,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorXY(NIBBLETYPE a_Meta)
NIBBLETYPE cBlockDoorHandler::MetaMirrorYZ(NIBBLETYPE a_Meta)
{
// Top bit (0x08) contains door panel type (Top/Bottom panel) Only Bottom panels contain position data
// Top bit (0x08) contains door panel type (Top / Bottom panel) Only Bottom panels contain position data
// Return a_Meta if panel is a top panel (0x08 bit is set to 1)
// Note: Currently, you can not properly mirror the hinges on a double door. The orientation of the door is stored
@ -165,7 +165,7 @@ NIBBLETYPE cBlockDoorHandler::MetaMirrorYZ(NIBBLETYPE a_Meta)
return a_Meta;
}
// Holds open/closed meta data. 0x0C == 1100.
// Holds open / closed meta data. 0x0C == 1100.
NIBBLETYPE OtherMeta = a_Meta & 0x0C;
// Mirrors according to a table. 0x03 == 0011.

View File

@ -106,7 +106,7 @@ public:
void FindAndSetPortalFrame(int X, int Y, int Z, cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface)
{
int MaxY = FindObsidianCeiling(X, Y, Z, a_ChunkInterface); // Get topmost obsidian block as reference for all other checks
int X1 = X + 1, Z1 = Z + 1, X2 = X - 1, Z2 = Z - 1; // Duplicate XZ values, add/subtract one as we've checked the original already the line above
int X1 = X + 1, Z1 = Z + 1, X2 = X - 1, Z2 = Z - 1; // Duplicate XZ values, add / subtract one as we've checked the original already the line above
if (MaxY == 0) // Oh noes! Not a portal coordinate :(
{
@ -139,7 +139,7 @@ public:
return;
}
/** Evaluates if coordinates are a portal going XP/XM; returns true if so, and writes boundaries to variable
/** Evaluates if coordinates are a portal going XP / XM; returns true if so, and writes boundaries to variable
Takes coordinates of base block and Y coord of target obsidian ceiling */
bool FindPortalSliceX(int X1, int X2, int Y, int Z, int MaxY, cChunkInterface & a_ChunkInterface)
{
@ -179,7 +179,7 @@ public:
return (FoundFrameXP && FoundFrameXM);
}
/// Evaluates if coords are a portal going ZP/ZM; returns true if so, and writes boundaries to variable
/// Evaluates if coords are a portal going ZP / ZM; returns true if so, and writes boundaries to variable
bool FindPortalSliceZ(int X, int Y, int Z1, int Z2, int MaxY, cChunkInterface & a_ChunkInterface)
{
Dir = 2;

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
{
// Flip the ON bit on/off using the XOR bitwise operation
// Flip the ON bit on / off using the XOR bitwise operation
NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x08);
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);

View File

@ -108,7 +108,7 @@ private:
case E_BLOCK_ENCHANTMENT_TABLE:
case E_BLOCK_END_PORTAL:
case E_BLOCK_END_PORTAL_FRAME:
// Notice the lack of an E_BLOCK_ENDER_CHEST here; its because ender chests can totally be pushed/pulled in MCS :)
// Notice the lack of an E_BLOCK_ENDER_CHEST here; its because ender chests can totally be pushed / pulled in MCS :)
case E_BLOCK_FURNACE:
case E_BLOCK_LIT_FURNACE:
case E_BLOCK_INVERTED_DAYLIGHT_SENSOR:

View File

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

View File

@ -35,7 +35,7 @@ public:
return;
}
// Flip the ON bit on/off using the XOR bitwise operation
// Flip the ON bit on / off using the XOR bitwise operation
NIBBLETYPE Meta = (a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ) ^ 0x04);
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta);

View File

@ -57,10 +57,10 @@ public:
/// Returns true if a boundingbox specified by a_Min and a_Max is inside this bounding box
bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max);
/// Returns true if the specified point is inside the bounding box specified by its min/max corners
/// Returns true if the specified point is inside the bounding box specified by its min / max corners
static bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max, const Vector3d & a_Point);
/// Returns true if the specified point is inside the bounding box specified by its min/max corners
/// Returns true if the specified point is inside the bounding box specified by its min / max corners
static bool IsInside(const Vector3d & a_Min, const Vector3d & a_Max, double a_X, double a_Y, double a_Z);
/** Returns true if this bounding box is intersected by the line specified by its two points

View File

@ -149,6 +149,39 @@ local g_ViolationPatterns =
-- No space before a closing parenthesis:
{" %)", "Remove the space before \")\""},
-- Check spaces around "+":
{"^[a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"},
{"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%+[a-zA-Z0-9]+", "Add space around +"},
--[[
-- Cannot check these because of text such as "X+" and "+2" appearing in some comments.
{"^[a-zA-Z0-9]+ %+[a-zA-Z0-9]+", "Add space after +"},
{"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+ %+[a-zA-Z0-9]+", "Add space after +"},
{"^[a-zA-Z0-9]+%+ [a-zA-Z0-9]+", "Add space before +"},
{"[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%+ [a-zA-Z0-9]+", "Add space before +"},
--]]
-- Cannot check spaces around "-", because the minus is sometimes used as a hyphen between-words
-- Check spaces around "*":
{"^[a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"},
{"^[^\"]*[!@#$%%%^&*() %[%]\t][a-zA-Z0-9]+%*[a-zA-Z0-9]+", "Add space around *"},
{"^[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);
std::list<const Vector3d*> playerPositions;
cPlayer* currentPlayer;
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr)
std::list<const Vector3d *> playerPositions;
cPlayer * currentPlayer;
for (auto itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr)
{
currentPlayer = (*itr)->GetPlayer();
playerPositions.push_back(&(currentPlayer->GetPosition()));
}
Vector3d currentPosition;
for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
for (auto itr = m_Entities.begin(); itr != m_Entities.end(); ++itr)
{
// LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass());
if ((*itr)->IsMob())
{
cMonster& Monster = (cMonster&)(**itr);
auto & Monster = reinterpret_cast<cMonster &>(**itr);
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());
}
@ -531,7 +531,7 @@ void cChunk::GetRandomBlockCoords(int & a_X, int & a_Y, int & a_Z)
void cChunk::SpawnMobs(cMobSpawner& a_MobSpawner)
void cChunk::SpawnMobs(cMobSpawner & a_MobSpawner)
{
int CenterX, CenterY, CenterZ;
GetRandomBlockCoords(CenterX, CenterY, CenterZ);
@ -737,7 +737,7 @@ void cChunk::ProcessQueuedSetBlocks(void)
{
if (GetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ) == itr->m_PreviousType)
{
// Current world age is bigger than/equal to target world age - delay time reached AND
// Current world age is bigger than / equal to target world age - delay time reached AND
// Previous block type was the same as current block type (to prevent duplication)
SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); // SetMeta doesn't send to client
itr = m_SetBlockQueue.erase(itr);
@ -751,7 +751,7 @@ void cChunk::ProcessQueuedSetBlocks(void)
}
else
{
// Current world age is bigger than/equal to target world age - delay time reached
// Current world age is bigger than / equal to target world age - delay time reached
SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta);
itr = m_SetBlockQueue.erase(itr);
LOGD("Successfully set queued block - previous type ignored");
@ -1026,7 +1026,7 @@ void cChunk::GrowMelonPumpkin(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_Bl
case E_BLOCK_FARMLAND:
{
// DEBUG: This is here to catch FS #349 - melons growing over other crops.
LOG("Growing melon/pumpkin overwriting %s, growing on %s",
LOG("Growing melon / pumpkin overwriting %s, growing on %s",
ItemTypeToString(BlockType[CheckType]).c_str(),
ItemTypeToString(Soil).c_str()
);
@ -1839,7 +1839,7 @@ bool cChunk::SetSignLines(int a_PosX, int a_PosY, int a_PosZ, const AString & a_
void cChunk::RemoveBlockEntity( cBlockEntity* a_BlockEntity)
void cChunk::RemoveBlockEntity(cBlockEntity * a_BlockEntity)
{
MarkDirty();
m_BlockEntities.remove(a_BlockEntity);

View File

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

View File

@ -65,7 +65,7 @@ cChunkMap::~cChunkMap()
void cChunkMap::RemoveLayer( cChunkLayer* a_Layer)
void cChunkMap::RemoveLayer(cChunkLayer * a_Layer)
{
cCSLock Lock(m_CSLayers);
m_Layers.remove(a_Layer);
@ -2716,12 +2716,12 @@ void cChunkMap::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ)
void cChunkMap::CollectMobCensus(cMobCensus& a_ToFill)
void cChunkMap::CollectMobCensus(cMobCensus & a_ToFill)
{
cCSLock Lock(m_CSLayers);
for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr)
for (auto && layer: m_Layers)
{
(*itr)->CollectMobCensus(a_ToFill);
layer->CollectMobCensus(a_ToFill);
} // for itr - m_Layers
}
@ -2730,12 +2730,12 @@ void cChunkMap::CollectMobCensus(cMobCensus& a_ToFill)
void cChunkMap::SpawnMobs(cMobSpawner& a_MobSpawner)
void cChunkMap::SpawnMobs(cMobSpawner & a_MobSpawner)
{
cCSLock Lock(m_CSLayers);
for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr)
for (auto && layer: m_Layers)
{
(*itr)->SpawnMobs(a_MobSpawner);
layer->SpawnMobs(a_MobSpawner);
} // for itr - m_Layers
}
@ -2936,7 +2936,7 @@ cChunk * cChunkMap::cChunkLayer::FindChunk(int a_ChunkX, int a_ChunkZ)
void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus& a_ToFill)
void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus & a_ToFill)
{
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
{
@ -2955,7 +2955,7 @@ void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus& a_ToFill)
void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner& a_MobSpawner)
void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner & a_MobSpawner)
{
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); i++)
{

View File

@ -64,7 +64,7 @@ public:
static const int LAYER_SIZE = 32;
cChunkMap(cWorld* a_World);
cChunkMap(cWorld * a_World);
~cChunkMap();
// Broadcast respective packets to all clients of the chunk where the event is taking place
@ -364,11 +364,11 @@ public:
/** Sets the blockticking to start at the specified block. Only one blocktick per chunk may be set, second call overwrites the first call */
void SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ);
/** Make a Mob census, of all mobs, their family, their chunk and theyr distance to closest player */
void CollectMobCensus(cMobCensus& a_ToFill);
/** Make a Mob census, of all mobs, their family, their chunk and their distance to closest player */
void CollectMobCensus(cMobCensus & a_ToFill);
/** Try to Spawn Monsters inside all Chunks */
void SpawnMobs(cMobSpawner& a_MobSpawner);
void SpawnMobs(cMobSpawner & a_MobSpawner);
void Tick(std::chrono::milliseconds a_Dt);
@ -433,9 +433,10 @@ private:
void UnloadUnusedChunks(void);
/** Collect a mob census, of all mobs, their megatype, their chunk and their distance o closest player */
void CollectMobCensus(cMobCensus& a_ToFill);
void CollectMobCensus(cMobCensus & a_ToFill);
/** Try to Spawn Monsters inside all Chunks */
void SpawnMobs(cMobSpawner& a_MobSpawner);
void SpawnMobs(cMobSpawner & a_MobSpawner);
void Tick(std::chrono::milliseconds a_Dt);

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)
Chunk data is queried using the cChunkDataCallback interface.
It is cached inside the ChunkSender object during the query and then processed after the query ends.
Note that the data needs to be compressed only *after* the query finishes,
Note that the data needs to be compressed only after the query finishes,
because the query callbacks run with ChunkMap's CS locked.
A client may remove itself from all direct requests(QueueSendChunkTo()) by calling RemoveClient();

View File

@ -436,7 +436,7 @@ bool cClientHandle::StreamNextChunk(void)
{
Vector3d Vector = Position + LookVector * cChunkDef::Width * Range;
// Get the chunk from the x/z coords.
// Get the chunk from the x / z coords.
int RangeX, RangeZ = 0;
cChunkDef::BlockToChunk(FloorC(Vector.x), FloorC(Vector.z), RangeX, RangeZ);
@ -454,7 +454,7 @@ bool cClientHandle::StreamNextChunk(void)
continue;
}
// If the chunk already loading/loaded -> skip
// If the chunk already loading / loaded -> skip
if (
(std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) ||
(std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.end())
@ -492,7 +492,7 @@ bool cClientHandle::StreamNextChunk(void)
{
cChunkCoords Coords = *itr;
// If the chunk already loading/loaded -> skip
// If the chunk already loading / loaded -> skip
if (
(std::find(m_ChunksToSend.begin(), m_ChunksToSend.end(), Coords) != m_ChunksToSend.end()) ||
(std::find(m_LoadedChunks.begin(), m_LoadedChunks.end(), Coords) != m_LoadedChunks.end())
@ -1154,7 +1154,7 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc
return;
}
// Set the last digging coords to the block being dug, so that they can be checked in DIG_FINISHED to avoid dig/aim bug in the client:
// Set the last digging coords to the block being dug, so that they can be checked in DIG_FINISHED to avoid dig / aim bug in the client:
m_HasStartedDigging = true;
m_LastDigBlockX = a_BlockX;
m_LastDigBlockY = a_BlockY;
@ -1201,7 +1201,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
(m_LastDigBlockZ != a_BlockZ)
)
{
LOGD("Prevented a dig/aim bug in the client (finish {%d, %d, %d} vs start {%d, %d, %d}, HSD: %s)",
LOGD("Prevented a dig / aim bug in the client (finish {%d, %d, %d} vs start {%d, %d, %d}, HSD: %s)",
a_BlockX, a_BlockY, a_BlockZ,
m_LastDigBlockX, m_LastDigBlockY, m_LastDigBlockZ,
(m_HasStartedDigging ? "True" : "False")
@ -1359,7 +1359,7 @@ void cClientHandle::HandleRightClick(int a_BlockX, int a_BlockY, int a_BlockZ, e
if (!CheckBlockInteractionsRate())
{
Kick("Too many blocks were placed/interacted with per unit time - hacked client?");
Kick("Too many blocks were placed / interacted with per unit time - hacked client?");
return;
}

View File

@ -391,7 +391,7 @@ private:
cPlayer * m_Player;
bool m_HasSentDC; ///< True if a D/C packet has been sent in either direction
bool m_HasSentDC; ///< True if a Disconnect packet has been sent in either direction
// Chunk position when the last StreamChunks() was called; used to avoid re-streaming while in the same chunk
int m_LastStreamedChunkX;
@ -416,7 +416,7 @@ private:
int m_BlockDigAnimY;
int m_BlockDigAnimZ;
// To avoid dig/aim bug in the client, store the last position given in a DIG_START packet and compare to that when processing the DIG_FINISH packet:
// To avoid dig / aim bug in the client, store the last position given in a DIG_START packet and compare to that when processing the DIG_FINISH packet:
bool m_HasStartedDigging;
int m_LastDigBlockX;
int m_LastDigBlockY;

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)
{
switch (a_BlockFace)

View File

@ -14,7 +14,7 @@
// fwd: WorldStorage/FastNBT.h
// fwd: "WorldStorage/FastNBT.h"
class cFastNBTWriter;
class cParsedNBT;
@ -138,10 +138,10 @@ public:
bool operator !=(const cEnchantments & a_Other) const;
/** Writes the enchantments into the specified NBT writer; begins with the LIST tag of the specified name ("ench" or "StoredEnchantments") */
friend void EnchantmentSerializer::WriteToNBTCompound(cEnchantments const& a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName);
friend void EnchantmentSerializer::WriteToNBTCompound(const cEnchantments & a_Enchantments, cFastNBTWriter & a_Writer, const AString & a_ListTagName);
/** Reads the enchantments from the specified NBT list tag (ench or StoredEnchantments) */
friend void EnchantmentSerializer::ParseFromNBT(cEnchantments& a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx);
friend void EnchantmentSerializer::ParseFromNBT(cEnchantments & a_Enchantments, const cParsedNBT & a_NBT, int a_EnchListTagIdx);
protected:
/** Maps enchantment ID -> enchantment level */

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

View File

@ -1309,7 +1309,8 @@ bool cEntity::DetectPortal()
if (IsPlayer())
{
((cPlayer *)this)->GetClientHandle()->SendRespawn(dimOverworld); // Send a respawn packet before world is loaded/generated so the client isn't left in limbo
// Send a respawn packet before world is loaded / generated so the client isn't left in limbo
((cPlayer *)this)->GetClientHandle()->SendRespawn(dimOverworld);
}
return MoveToWorld(cRoot::Get()->CreateAndInitializeWorld(GetWorld()->GetLinkedOverworldName()), false);
@ -1688,8 +1689,8 @@ void cEntity::BroadcastMovementUpdate(const cClientHandle * a_Exclude)
{
m_World->BroadcastEntityRelMove(*this, (char)DiffX, (char)DiffY, (char)DiffZ, a_Exclude);
}
// Clients seem to store two positions, one for the velocity packet and one for the teleport/relmove packet
// The latter is only changed with a relmove/teleport, and m_LastPos stores this position
// Clients seem to store two positions, one for the velocity packet and one for the teleport / relmove packet
// The latter is only changed with a relmove / teleport, and m_LastPos stores this position
m_LastPos = GetPosition();
}
else

View File

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

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
TierCoeff = (GetPotionEffectIntensity(a_ItemDamage) > 0) ? 0.5 : 1;
// If potion is extended, multiply duration by 8/3. If not, stays the same
// If potion is extended, multiply duration by 8 / 3. If not, stays the same
// Extended potion if sixth lowest bit is set
ExtCoeff = (a_ItemDamage & 0x40) ? (8.0 / 3.0) : 1;
// If potion is splash potion, multiply duration by 3/4. If not, stays the same
// If potion is splash potion, multiply duration by 3 / 4. If not, stays the same
SplashCoeff = IsPotionDrinkable(a_ItemDamage) ? 1 : 0.75;
// Ref.:

View File

@ -905,7 +905,7 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
}
/* Check to which side the minecart is to be pushed.
Let's consider a z-x-coordinate system where the minecart is the center (0/0).
Let's consider a z-x-coordinate system where the minecart is the center (0, 0).
The minecart moves along the line x = -z, the perpendicular line to this is x = z.
In order to decide to which side the minecart is to be pushed, it must be checked on what side of the perpendicular line the pushing entity is located. */
if (
@ -954,7 +954,7 @@ bool cMinecart::TestEntityCollision(NIBBLETYPE a_RailMeta)
}
/* Check to which side the minecart is to be pushed.
Let's consider a z-x-coordinate system where the minecart is the center (0/0).
Let's consider a z-x-coordinate system where the minecart is the center (0, 0).
The minecart moves along the line x = z, the perpendicular line to this is x = -z.
In order to decide to which side the minecart is to be pushed, it must be checked on what side of the perpendicular line the pushing entity is located. */
if (

View File

@ -29,7 +29,7 @@ public:
enum ePayload
{
mpNone = 0, // Empty minecart, ridable by player or mobs
mpChest = 1, // Minecart-with-chest, can store a grid of 3*8 items
mpChest = 1, // Minecart-with-chest, can store a grid of 3 * 8 items
mpFurnace = 2, // Minecart-with-furnace, can be powered
mpTNT = 3, // Minecart-with-TNT, can be blown up with activator rail
mpHopper = 5, // Minecart-with-hopper, can be hopper
@ -54,8 +54,7 @@ protected:
cMinecart(ePayload a_Payload, double a_X, double a_Y, double a_Z);
/** Handles physics on normal rails
For each tick, slow down on flat rails, speed up or slow down on ascending/descending rails (depending on direction), and turn on curved rails
*/
For each tick, slow down on flat rails, speed up or slow down on ascending / descending rails (depending on direction), and turn on curved rails. */
void HandleRailPhysics(NIBBLETYPE a_RailMeta, std::chrono::milliseconds a_Dt);
/** Handles powered rail physics

View File

@ -355,7 +355,7 @@ float cPlayer::GetXpPercentage()
int currentLevel_XpBase = XpForLevel(currentLevel);
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)
{
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);
return false; // oops, they gave us a dodgey number
@ -403,7 +403,7 @@ int cPlayer::DeltaExperience(int a_Xp_delta)
m_LifetimeTotalXp += a_Xp_delta;
}
LOGD("Player \"%s\" gained/lost %d experience, total is now: %d", GetName().c_str(), a_Xp_delta, m_CurrentXp);
LOGD("Player \"%s\" gained / lost %d experience, total is now: %d", GetName().c_str(), a_Xp_delta, m_CurrentXp);
// Set experience to be updated
m_bDirtyExperience = true;
@ -1771,7 +1771,7 @@ bool cPlayer::LoadFromFile(const AString & a_FileName, cWorldPtr & a_World)
m_LastBedPos.z = root.get("SpawnZ", a_World->GetSpawnZ()).asInt();
// Load the player stats.
// We use the default world name (like bukkit) because stats are shared between dimensions/worlds.
// We use the default world name (like bukkit) because stats are shared between dimensions / worlds.
cStatSerializer StatSerializer(cRoot::Get()->GetDefaultWorld()->GetName(), GetName(), &m_Stats);
StatSerializer.Load();
@ -1868,7 +1868,7 @@ bool cPlayer::SaveToDisk()
}
// Save the player stats.
// We use the default world name (like bukkit) because stats are shared between dimensions/worlds.
// We use the default world name (like bukkit) because stats are shared between dimensions / worlds.
cStatSerializer StatSerializer(cRoot::Get()->GetDefaultWorld()->GetName(), GetName(), &m_Stats);
if (!StatSerializer.Save())
{
@ -2076,7 +2076,7 @@ void cPlayer::UpdateMovementStats(const Vector3d & a_DeltaPos)
}
else
{
if (Value >= 25) // Ignore small/slow movement
if (Value >= 25) // Ignore small / slow movement
{
m_Stats.AddValue(statDistFlown, Value);
}

View File

@ -644,7 +644,7 @@ protected:
virtual void Destroyed(void);
/** Filters out damage for creative mode/friendly fire */
/** Filters out damage for creative mode / friendly fire */
virtual bool DoTakeDamage(TakeDamageInfo & TDI) override;
/** Stops players from burning in creative mode */

View File

@ -109,7 +109,7 @@ protected:
eKind m_ProjectileKind;
/** The structure for containing the entity ID and name who has created this projectile
The ID and/or name may be nullptr (e.g. for dispensers/mobs). */
The ID and / or name may be nullptr (e.g. for dispensers / mobs). */
CreatorData m_CreatorData;
/** True if the projectile has hit the ground and is stuck there */

View File

@ -237,7 +237,7 @@ bool cCaveTunnel::RefineDefPoints(const cCaveDefPoints & a_Src, cCaveDefPoints &
return true;
}
// Smoothing: for each line segment, add points on its 1/4 lengths
// Smoothing: for each line segment, add points on its 1 / 4 lengths
bool res = false;
size_t Num = a_Src.size() - 2; // this many intermediary points
a_Dst.clear();
@ -488,7 +488,7 @@ void cCaveTunnel::ProcessChunk(
continue;
}
// Carve out a sphere around the xyz point, m_Radius in diameter; skip 3/7 off the top and bottom:
// Carve out a sphere around the xyz point, m_Radius in diameter; skip 3 / 7 off the top and bottom:
int DifX = itr->m_BlockX - BlockStartX; // substitution for faster calc
int DifY = itr->m_BlockY;
int DifZ = itr->m_BlockZ - BlockStartZ; // substitution for faster calc
@ -529,7 +529,7 @@ void cCaveTunnel::ProcessChunk(
/*
#ifdef _DEBUG
// For debugging purposes, outline the shape of the cave using glowstone, *after* carving the entire cave:
// For debugging purposes, outline the shape of the cave using glowstone, after carving the entire cave:
for (cCaveDefPoints::const_iterator itr = m_Points.begin(), end = m_Points.end(); itr != end; ++itr)
{
int DifX = itr->m_BlockX - BlockStartX; // substitution for faster calc

View File

@ -209,7 +209,7 @@ void cChunkGenerator::Execute(void)
{
if ((NumChunksGenerated > 16) && (clock() - LastReportTick > CLOCKS_PER_SEC))
{
LOG("Chunk generator performance: %.2f ch/s (%d ch total)",
LOG("Chunk generator performance: %.2f ch / sec (%d ch total)",
(double)NumChunksGenerated * CLOCKS_PER_SEC/ (clock() - GenerationStart),
NumChunksGenerated
);
@ -241,7 +241,7 @@ void cChunkGenerator::Execute(void)
// Display perf info once in a while:
if ((NumChunksGenerated > 16) && (clock() - LastReportTick > 2 * CLOCKS_PER_SEC))
{
LOG("Chunk generator performance: %.2f ch/s (%d ch total)",
LOG("Chunk generator performance: %.2f ch / sec (%d ch total)",
(double)NumChunksGenerated * CLOCKS_PER_SEC / (clock() - GenerationStart),
NumChunksGenerated
);

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
int Size = 3 + m_Noise.IntNoise3DInt(ChunkX, i, ChunkZ) % 3;
// Generate X/Z coordinates.
// Generate X / Z coordinates.
int X = Size + (m_Noise.IntNoise2DInt(i, Size) % (cChunkDef::Width - Size * 2));
int Z = Size + (m_Noise.IntNoise2DInt(X, i) % (cChunkDef::Width - Size * 2));

View File

@ -667,7 +667,7 @@ public:
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap)
{
// Generate the biomes for the 3*3 neighbors:
// Generate the biomes for the 3 * 3 neighbors:
cChunkDef::BiomeMap neighborBiomes[3][3];
for (int z = 0; z < 3; z++) for (int x = 0; x < 3; x++)
{

View File

@ -5,7 +5,7 @@
/*
The integers generated may be interpreted in several ways:
- land/see designators
- land / sea designators
- 0 = ocean
- >0 = land
- biome group
@ -310,7 +310,7 @@ public:
}
}
// Copy from Cache into a_Values; take into account the even/odd offsets in a_Min:
// Copy from Cache into a_Values; take into account the even / odd offsets in a_Min:
for (int z = 0; z < SizeZ; ++z)
{
memcpy(a_Values + z * SizeX, cache + (z + (a_MinZ & 1)) * lowStepX + (a_MinX & 1), SizeX * sizeof(int));

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)
{
// Generate the 3*3 chunks of biomes around this chunk:
// Generate the 3 * 3 chunks of biomes around this chunk:
cChunkDef::BiomeMap neighborBiomes[3 * 3];
for (int z = 0; z < 3; z++)
{

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)
{
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 */
cNoise m_Noise;
/** Maximum size, in X/Z blocks, of the village (radius from the origin) */
/** Maximum size, in X / Z blocks, of the village (radius from the origin) */
int m_MaxSize;
/** Borders of the vilalge - no item may reach out of this cuboid. */

View File

@ -34,7 +34,7 @@ protected:
/** Maximum depth of the generator tree*/
int m_MaxDepth;
/** Maximum size, in X/Z blocks, of the base (radius from the origin) */
/** Maximum size, in X / Z blocks, of the structure (radius from the origin) */
int m_MaxSize;

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)
{
// Modify the size slightly to have different-sized ravines (1/2 to 1/1 of a_Size):
// Modify the size slightly to have different-sized ravines (1 / 2 to 1 / 1 of a_Size):
a_Size = (512 + ((a_Noise.IntNoise3DInt(19 * a_BlockX, 11 * a_BlockZ, a_BlockX + a_BlockZ) / 17) % 512)) * a_Size / 1024;
// The complete offset of the ravine from its cellpoint, up to 2 * a_Size in each direction
@ -177,7 +177,7 @@ void cStructGenRavines::cRavine::RefineDefPoints(const cRavDefPoints & a_Src, cR
return;
}
// Smoothing: for each line segment, add points on its 1/4 lengths
// Smoothing: for each line segment, add points on its 1 / 4 lengths
size_t Num = a_Src.size() - 2; // this many intermediary points
a_Dst.clear();
a_Dst.reserve(Num * 2 + 2);

View File

@ -311,7 +311,7 @@ void cStructGenOreNests::GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_Ore
rnd /= cChunkDef::Width;
int BaseY = rnd % a_MaxHeight;
rnd /= a_MaxHeight;
int NestSize = a_NestSize + (rnd % (a_NestSize / 4)); // The actual nest size may be up to 1/4 larger
int NestSize = a_NestSize + (rnd % (a_NestSize / 4)); // The actual nest size may be up to 1 / 4 larger
int Num = 0;
while (Num < NestSize)
{

View File

@ -61,7 +61,7 @@ protected:
/** The noise used as a pseudo-random generator */
cNoise m_Noise;
/** Maximum size, in X/Z blocks, of the structure (radius from the origin) */
/** Maximum size, in X / Z blocks, of the structure (radius from the origin) */
int m_MaxSize;
/** Borders of the structure - no item may reach out of this cuboid. */

View File

@ -31,10 +31,10 @@ protected:
/** The noise used for generating random numbers */
cNoise m_Noise;
/** Maximum depth of the generator tree*/
/** Maximum depth of the generator tree */
int m_MaxDepth;
/** Maximum size, in X/Z blocks, of the base (radius from the origin) */
/** Maximum size, in X / Z blocks, of the structure (radius from the origin) */
int m_MaxSize;

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);
h--;
// Third and fourth layers - BigO2 and maybe 2*Corners:
// Third and fourth layers - BigO2 and maybe 2 * Corners:
for (int Row = 0; Row < 2; Row++)
{
PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
@ -673,7 +673,7 @@ void GetTallBirchTreeImage(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_
PushCornerBlocks(a_BlockX, h, a_BlockZ, a_Seq, a_Noise, 0x5fffffff, a_OtherBlocks, 1, E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);
h--;
// Third and fourth layers - BigO2 and maybe 2*Corners:
// Third and fourth layers - BigO2 and maybe 2 * Corners:
for (int Row = 0; Row < 2; Row++)
{
PushCoordBlocks (a_BlockX, h, a_BlockZ, a_OtherBlocks, BigO2, ARRAYCOUNT(BigO2), E_BLOCK_LEAVES, E_META_LEAVES_BIRCH);

View File

@ -61,7 +61,7 @@ protected:
/** The noise used as a pseudo-random generator */
cNoise m_Noise;
/** Maximum size, in X/Z blocks, of the village (radius from the origin) */
/** Maximum size, in X / Z blocks, of the base (radius from the origin) */
int m_MaxSize;
/** Borders of the vilalge - no item may reach out of this cuboid. */

View File

@ -34,7 +34,7 @@ protected:
/** Maximum depth of the generator tree*/
int m_MaxDepth;
/** Maximum size, in X/Z blocks, of the base (radius from the origin) */
/** Maximum size, in X / Z blocks, of the structure (radius from the origin) */
int m_MaxSize;
/** The underlying biome generator that defines whether the base is created or not */

View File

@ -162,7 +162,7 @@ protected:
/** The noise used as a pseudo-random generator */
cNoise m_Noise;
/** Maximum size, in X/Z blocks, of the village (radius from the origin) */
/** Maximum size, in X / Z blocks, of the village (radius from the origin) */
int m_MaxSize;
/** The density for this village. Used to refrain from populating all house connectors. Range [0, 100] */

View File

@ -32,7 +32,7 @@ protected:
/** Maximum depth of the generator tree*/
int m_MaxDepth;
/** Maximum size, in X/Z blocks, of the village (radius from the origin) */
/** Maximum size, in X / Z blocks, of the village (radius from the origin) */
int m_MaxSize;
/** Minimum density - percentage of allowed house connections. Range [0, 100] */

View File

@ -18,9 +18,9 @@
// Useful warnings from warning level 4:
#pragma warning(3 : 4189) // Local variable is initialized but not referenced
#pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed/unsigned mismatch
#pragma warning(3 : 4245) // Conversion from 'type1' to 'type2', signed / unsigned mismatch
#pragma warning(3 : 4310) // Cast truncates constant value
#pragma warning(3 : 4389) // Signed/unsigned mismatch
#pragma warning(3 : 4389) // Signed / unsigned mismatch
#pragma warning(3 : 4505) // Unreferenced local function has been removed
#pragma warning(3 : 4701) // Potentially unitialized local variable used
#pragma warning(3 : 4702) // Unreachable code

View File

@ -61,7 +61,7 @@ public:
AString m_LastValue;
/** Notifies the callback of the key/value stored in m_LastKey/m_LastValue, then erases them */
/** Notifies the callback of the key / value stored in m_LastKey / m_LastValue, then erases them */
void NotifyLast(void);
/** Parses one line of header data. Returns true if successful */

View File

@ -202,7 +202,7 @@ size_t cHTTPRequest::ParseRequestLine(const char * a_Data, size_t a_Size)
m_IsValid = false;
return AString::npos;
}
// Check that there's HTTP/version at the end
// Check that there's HTTP / version at the end
if (strncmp(m_IncomingHeaderData.c_str() + URLEnd + 1, "HTTP/1.", 7) != 0)
{
m_IsValid = false;

View File

@ -1,11 +1,11 @@
// IniFile.cpp: Implementation of the CIniFile class.
// Written by: Adam Clauss
// Email: cabadam@houston.rr.com
// You may use this class/code as you wish in your programs. Feel free to distribute it, and
// You may use this class / code as you wish in your programs. Feel free to distribute it, and
// email suggested changes to me.
//
// Rewritten by: Shane Hill
// Date: 21/08/2001
// Date: 2001-08-21
// Email: Shane.Hill@dsto.defence.gov.au
// Reason: Remove dependancy on MFC. Code should compile on any
// platform.

View File

@ -1,14 +1,14 @@
// IniFile.cpp: Implementation of the CIniFile class.
// Written by: Adam Clauss
// Email: cabadam@tamu.edu
// You may use this class/code as you wish in your programs. Feel free to distribute it, and
// You may use this class / code as you wish in your programs. Feel free to distribute it, and
// email suggested changes to me.
//
// Rewritten by: Shane Hill
// Date: 21/08/2001
// Date: 2001-08-21
// Email: Shane.Hill@dsto.defence.gov.au
// Reason: Remove dependancy on MFC. Code should compile on any
// platform. Tested on Windows/Linux/Irix
// platform. Tested on Windows / Linux / Irix
////////////////////////////////////////////////////////////////////////////////
/*
@ -108,7 +108,7 @@ public:
// Gets value of [keyname] valuename =.
// Overloaded to return string, int, and double.
// Returns defValue if key/value not found.
// Returns defValue if key / value not found.
AString GetValue (const AString & keyname, const AString & valuename, const AString & defValue = "") const;
AString GetValue (const int keyID, const int valueID, const AString & defValue = "") const;
double GetValueF(const AString & keyname, const AString & valuename, const double defValue = 0) const;
@ -217,7 +217,7 @@ public:
/** Reads the list of ports from the INI file, possibly upgrading from IPv4/IPv6-specific values into new version-agnostic value.
/** Reads the list of ports from the INI file, possibly upgrading from IPv4 / IPv6-specific values into new version-agnostic value.
Reads the list of ports from a_PortsValueName. If that value doesn't exist or is empty, the list is combined from values
in a_OldIPv4ValueName and a_OldIPv6ValueName; in this case the old values are removed from the INI file.
If there is none of the three values or they are all empty, the default is used and stored in the Ports value. */

View File

@ -499,7 +499,7 @@ int cInventory::ArmorSlotNumToEntityEquipmentID(short a_ArmorSlotNum)
#if 0
bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode /* = 0 */)
bool cInventory::AddToBar(cItem & a_Item, const int a_Offset, const int a_Size, bool * a_bChangedSlots, int a_Mode /* = 0 */)
{
// Fill already present stacks
if (a_Mode < 2)

View File

@ -171,7 +171,7 @@ public:
bool LoadFromJson(Json::Value & a_Value);
protected:
bool AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode = 0);
bool AddToBar(cItem & a_Item, const int a_Offset, const int a_Size, bool * a_bChangedSlots, int a_Mode = 0);
cItemGrid m_ArmorSlots;
cItemGrid m_InventorySlots;

View File

@ -78,7 +78,7 @@ public:
!BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision(&a_Player, PlaceMeta)
)
{
// Tried to place a block *into* another?
// Tried to place a block into another?
// Happens when you place a block aiming at side of block with a torch on it or stem beside it
return false;
}

View File

@ -362,7 +362,7 @@ bool cItemHandler::OnPlayerPlace(
!BlockHandler(PlaceBlock)->DoesIgnoreBuildCollision(&a_Player, PlaceMeta)
)
{
// Tried to place a block *into* another?
// Tried to place a block into another?
// Happens when you place a block aiming at side of block with a torch on it or stem beside it
return false;
}
@ -543,8 +543,9 @@ char cItemHandler::GetMaxStackSize(void)
case E_ITEM_COMPASS: return 64;
case E_ITEM_COOKED_CHICKEN: return 64;
case E_ITEM_COOKED_FISH: return 64;
case E_ITEM_COOKED_PORKCHOP: return 64;
case E_ITEM_COOKED_MUTTON: return 64;
case E_ITEM_COOKED_PORKCHOP: return 64;
case E_ITEM_COOKED_RABBIT: return 64;
case E_ITEM_COOKIE: return 64;
case E_ITEM_DARK_OAK_DOOR: return 64;
case E_ITEM_DIAMOND: return 64;
@ -579,6 +580,7 @@ char cItemHandler::GetMaxStackSize(void)
case E_ITEM_MELON_SEEDS: return 64;
case E_ITEM_MELON_SLICE: return 64;
case E_ITEM_NETHER_BRICK: return 64;
case E_ITEM_NETHER_QUARTZ: return 64;
case E_ITEM_NETHER_WART: return 64;
case E_ITEM_PAINTING: return 64;
case E_ITEM_PAPER: return 64;
@ -595,6 +597,7 @@ char cItemHandler::GetMaxStackSize(void)
case E_ITEM_RAW_FISH: return 64;
case E_ITEM_RAW_MUTTON: return 64;
case E_ITEM_RAW_PORKCHOP: return 64;
case E_ITEM_RAW_RABBIT: return 64;
case E_ITEM_RED_APPLE: return 64;
case E_ITEM_REDSTONE_DUST: return 64;
case E_ITEM_REDSTONE_REPEATER: return 64;

View File

@ -64,7 +64,7 @@ public:
}
default:
{
// Light a fire next to/on top of the block if air:
// Light a fire next to / on top of the block if air:
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, a_BlockFace);
if ((a_BlockY < 0) || (a_BlockY >= cChunkDef::Height))
{

View File

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

View File

@ -46,10 +46,10 @@ private:
extern void LOG(const char* a_Format, ...) FORMATSTRING(1, 2);
extern void LOGINFO(const char* a_Format, ...) FORMATSTRING(1, 2);
extern void LOGWARN(const char* a_Format, ...) FORMATSTRING(1, 2);
extern void LOGERROR(const char* a_Format, ...) FORMATSTRING(1, 2);
extern void LOG (const char * a_Format, ...) FORMATSTRING(1, 2);
extern void LOGINFO (const char * a_Format, ...) FORMATSTRING(1, 2);
extern void LOGWARN (const char * a_Format, ...) FORMATSTRING(1, 2);
extern void LOGERROR(const char * a_Format, ...) FORMATSTRING(1, 2);

View File

@ -591,7 +591,7 @@ void cMap::SendTo(cClientHandle & a_Client)
for (unsigned int i = 0; i < m_Width; ++i)
{
const Byte* Colors = &m_Data[i * m_Height];
const Byte * Colors = &m_Data[i * m_Height];
a_Client.SendMapColumn(m_ID, i, 0, Colors, m_Height, m_Scale);
}

View File

@ -140,7 +140,7 @@ public:
/** Update a circular region around the specified player. */
void UpdateRadius(cPlayer & a_Player, unsigned int a_Radius);
/** Send next update packet to the specified player and remove invalid decorators/clients. */
/** Send next update packet to the specified player and remove invalid decorators / clients. */
void UpdateClient(cPlayer * a_Player);
// tolua_begin

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)
{
const int ratio = 319; // This should be 256 as we are only supposed to take account from chunks that are in 17x17 from a player
// but for now, we use all chunks loaded by players. that means 19 x 19 chunks. That's why we use 256 * (19*19) / (17*17) = 319
const int ratio = 319; // This should be 256 as we are only supposed to take account from chunks that are in 17 x 17 from a player
// but for now, we use all chunks loaded by players. that means 19 x 19 chunks. That's why we use 256 * (19 * 19) / (17 * 17) = 319
// MG TODO : code the correct count
if ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio >= m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily))
{

View File

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

View File

@ -6,7 +6,11 @@
#include "Entities/Entity.h"
#include "Chunk.h"
void cMobProximityCounter::CollectMob(cEntity& a_Monster, cChunk& a_Chunk, double a_Distance)
void cMobProximityCounter::CollectMob(cEntity & a_Monster, cChunk & a_Chunk, double a_Distance)
{
// LOGD("Collecting monster %s, with distance %f", a_Monster->GetClass(), a_Distance);
tMonsterToDistance::iterator it = m_MonsterToDistance.find(&a_Monster);

View File

@ -16,19 +16,19 @@ protected :
// structs used for later maps (see m_MonsterToDistance and m_DistanceToMonster)
struct sDistanceAndChunk
{
sDistanceAndChunk(double a_Distance, cChunk& a_Chunk) : m_Distance(a_Distance), m_Chunk(&a_Chunk) {}
sDistanceAndChunk(double a_Distance, cChunk & a_Chunk) : m_Distance(a_Distance), m_Chunk(&a_Chunk) {}
double m_Distance;
cChunk* m_Chunk;
cChunk * m_Chunk;
};
struct sMonsterAndChunk
{
sMonsterAndChunk(cEntity& a_Monster, cChunk& a_Chunk) : m_Monster(a_Monster), m_Chunk(a_Chunk) {}
cEntity& m_Monster;
cChunk& m_Chunk;
sMonsterAndChunk(cEntity & a_Monster, cChunk & a_Chunk) : m_Monster(a_Monster), m_Chunk(a_Chunk) {}
cEntity & m_Monster;
cChunk & m_Chunk;
};
public :
typedef std::map<cEntity*, sDistanceAndChunk> tMonsterToDistance;
typedef std::map<cEntity *, sDistanceAndChunk> tMonsterToDistance;
typedef std::multimap<double, sMonsterAndChunk> tDistanceToMonster;
protected :
@ -50,7 +50,7 @@ public :
// count a mob on a specified chunk with specified distance to an unkown player
// if the distance is shortest than the one collected, this become the new closest
// distance and the chunk become the "hosting" chunk (that is the one that will perform the action)
void CollectMob(cEntity& a_Monster, cChunk& a_Chunk, double a_Distance);
void CollectMob(cEntity & a_Monster, cChunk & a_Chunk, double a_Distance);
// return the mobs that are within the range of distance of the closest player they are
// that means that if a mob is 30 m from a player and 150 m from another one. It will be

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)
{
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
// BlockType & BlockMeta are used to decide what kind of Mob can Spawn here
// MaxPackSize is set to the maximal size for a pack this type of mob
cMonster * TryToSpawnHere(cChunk * a_Chunk, int A_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int& a_MaxPackSize);
cMonster * TryToSpawnHere(cChunk * a_Chunk, int A_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int & a_MaxPackSize);
// mark the beginning of a new Pack
// all mobs of the same Pack are the same type

View File

@ -7,7 +7,7 @@
cMagmaCube::cMagmaCube(int a_Size) :
super("MagmaCube", mtMagmaCube, "mob.MagmaCube.big", "mob.MagmaCube.big", 0.6 * a_Size, 0.6 * a_Size),
super("MagmaCube", mtMagmaCube, Printf("mob.magmacube.%s", GetSizeName(a_Size).c_str()), Printf("mob.magmacube.%s", GetSizeName(a_Size).c_str()), 0.6 * a_Size, 0.6 * a_Size),
m_Size(a_Size)
{
}
@ -27,4 +27,14 @@ void cMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer)
AString cMagmaCube::GetSizeName(int a_Size)
{
if (a_Size > 1)
{
return "big";
}
else
{
return "small";
}
}

View File

@ -19,10 +19,14 @@ public:
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
int GetSize(void) const { return m_Size; }
/** Returns the text describing the slime's size, as used by the client's resource subsystem for sounds.
Returns either "big" or "small". */
static AString GetSizeName(int a_Size);
protected:
/// Size of the MagmaCube, 1 .. 3, with 1 being the smallest
/// Size of the MagmaCube, 1, 2 and 4, with 1 being the smallest
int m_Size;
} ;

View File

@ -264,12 +264,14 @@ bool cMonster::EnsureProperDestination(cChunk & a_Chunk)
cChunk * Chunk = a_Chunk.GetNeighborChunk(FloorC(m_FinalDestination.x), FloorC(m_FinalDestination.z));
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;
int RelX = FloorC(m_FinalDestination.x) - Chunk->GetPosX() * cChunkDef::Width;
int RelZ = FloorC(m_FinalDestination.z) - Chunk->GetPosZ() * cChunkDef::Width;
if ((Chunk == nullptr) || !Chunk->IsValid())
{
return false;
}
int RelX = FloorC(m_FinalDestination.x) - Chunk->GetPosX() * cChunkDef::Width;
int RelZ = FloorC(m_FinalDestination.z) - Chunk->GetPosZ() * cChunkDef::Width;
// If destination in the air, go down to the lowest air block.
while (m_FinalDestination.y > 0)
@ -958,7 +960,7 @@ cMonster * cMonster::NewMonsterFromType(eMonsterType a_MobType)
{
case mtMagmaCube:
{
toReturn = new cMagmaCube(Random.NextInt(2) + 1);
toReturn = new cMagmaCube(1 << Random.NextInt(3)); // Size 1, 2 or 4
break;
}
case mtSlime:

View File

@ -224,7 +224,7 @@ protected:
Calls ResetPathFinding and sets m_IsFollowingPath to false */
void StopMovingToPosition();
/** Sets the body yaw and head yaw/pitch based on next/ultimate destinations */
/** Sets the body yaw and head yaw / pitch based on next / ultimate destinations */
void SetPitchAndYawFromDestination(void);
virtual void HandleFalling(void);

View File

@ -8,7 +8,7 @@
#define DISTANCE_MANHATTAN 0 // 1: More speed, a bit less accuracy 0: Max accuracy, less speed.
#define HEURISTICS_ONLY 0 // 1: Much more speed, much less accurate.
#define CALCULATIONS_PER_STEP 60 // Higher means more CPU load but faster path calculations.
#define CALCULATIONS_PER_STEP 5 // Higher means more CPU load but faster path calculations.
// The only version which guarantees the shortest path is 0, 0.
enum class eCellStatus {OPENLIST, CLOSEDLIST, NOLIST};

View File

@ -12,7 +12,7 @@ Put this in your .cpp:
*/
#ifdef COMPILING_PATHFIND_DEBUGGER
/* Note: the COMPILING_PATHFIND_DEBUGGER flag is used by Native/WiseOldMan95 to debug
/* Note: the COMPILING_PATHFIND_DEBUGGER flag is used by Native / WiseOldMan95 to debug
this class outside of MCServer. This preprocessor flag is never set when compiling MCServer. */
#include "PathFinderIrrlicht_Head.h"
#endif

View File

@ -89,7 +89,7 @@ void cSlime::KilledBy(TakeDamageInfo & a_TDI)
const AString cSlime::GetSizeName(int a_Size) const
AString cSlime::GetSizeName(int a_Size)
{
if (a_Size > 1)
{

View File

@ -27,7 +27,7 @@ public:
/** Returns the text describing the slime's size, as used by the client's resource subsystem for sounds.
Returns either "big" or "small". */
const AString GetSizeName(int a_Size) const;
static AString GetSizeName(int a_Size);
protected:

View File

@ -23,7 +23,7 @@ public:
private:
struct sAttributesStruct;
struct sMonsterConfigState;
sMonsterConfigState* m_pState;
sMonsterConfigState * m_pState;
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 x1interp1 = CubicInterpolate( points1[0][0], points1[0][1], points1[0][2], points1[0][3], FracX);
const NOISE_DATATYPE x1interp2 = CubicInterpolate( points1[1][0], points1[1][1], points1[1][2], points1[1][3], FracX);
const NOISE_DATATYPE x1interp3 = CubicInterpolate( points1[2][0], points1[2][1], points1[2][2], points1[2][3], FracX);
const NOISE_DATATYPE x1interp4 = CubicInterpolate( points1[3][0], points1[3][1], points1[3][2], points1[3][3], FracX);
const NOISE_DATATYPE x1interp1 = CubicInterpolate(points1[0][0], points1[0][1], points1[0][2], points1[0][3], FracX);
const NOISE_DATATYPE x1interp2 = CubicInterpolate(points1[1][0], points1[1][1], points1[1][2], points1[1][3], FracX);
const NOISE_DATATYPE x1interp3 = CubicInterpolate(points1[2][0], points1[2][1], points1[2][2], points1[2][3], FracX);
const NOISE_DATATYPE x1interp4 = CubicInterpolate(points1[3][0], points1[3][1], points1[3][2], points1[3][3], FracX);
const NOISE_DATATYPE points2[4][4] =
{
@ -646,45 +646,45 @@ NOISE_DATATYPE cNoise::CubicNoise3D(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Y, NOIS
{ IntNoise3D(BaseX - 1, BaseY + 2, BaseZ), IntNoise3D(BaseX, BaseY + 2, BaseZ), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ), },
};
const NOISE_DATATYPE x2interp1 = CubicInterpolate( points2[0][0], points2[0][1], points2[0][2], points2[0][3], FracX);
const NOISE_DATATYPE x2interp2 = CubicInterpolate( points2[1][0], points2[1][1], points2[1][2], points2[1][3], FracX);
const NOISE_DATATYPE x2interp3 = CubicInterpolate( points2[2][0], points2[2][1], points2[2][2], points2[2][3], FracX);
const NOISE_DATATYPE x2interp4 = CubicInterpolate( points2[3][0], points2[3][1], points2[3][2], points2[3][3], FracX);
const NOISE_DATATYPE x2interp1 = CubicInterpolate(points2[0][0], points2[0][1], points2[0][2], points2[0][3], FracX);
const NOISE_DATATYPE x2interp2 = CubicInterpolate(points2[1][0], points2[1][1], points2[1][2], points2[1][3], FracX);
const NOISE_DATATYPE x2interp3 = CubicInterpolate(points2[2][0], points2[2][1], points2[2][2], points2[2][3], FracX);
const NOISE_DATATYPE x2interp4 = CubicInterpolate(points2[3][0], points2[3][1], points2[3][2], points2[3][3], FracX);
const NOISE_DATATYPE points3[4][4] =
{
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+1), IntNoise3D( BaseX, BaseY-1, BaseZ+1), IntNoise3D( BaseX+1, BaseY-1, BaseZ+1), IntNoise3D( BaseX+2, BaseY-1, BaseZ + 1), },
{ IntNoise3D( BaseX-1, BaseY, BaseZ+1), IntNoise3D( BaseX, BaseY, BaseZ+1), IntNoise3D( BaseX+1, BaseY, BaseZ+1), IntNoise3D( BaseX+2, BaseY, BaseZ + 1), },
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+1), IntNoise3D( BaseX, BaseY+1, BaseZ+1), IntNoise3D( BaseX+1, BaseY+1, BaseZ+1), IntNoise3D( BaseX+2, BaseY+1, BaseZ + 1), },
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+1), IntNoise3D( BaseX, BaseY+2, BaseZ+1), IntNoise3D( BaseX+1, BaseY+2, BaseZ+1), IntNoise3D( BaseX+2, BaseY+2, BaseZ + 1), },
{ IntNoise3D(BaseX - 1, BaseY - 1, BaseZ + 1), IntNoise3D(BaseX, BaseY - 1, BaseZ + 1), IntNoise3D(BaseX + 1, BaseY - 1, BaseZ + 1), IntNoise3D(BaseX + 2, BaseY - 1, BaseZ + 1), },
{ IntNoise3D(BaseX - 1, BaseY, BaseZ + 1), IntNoise3D(BaseX, BaseY, BaseZ + 1), IntNoise3D(BaseX + 1, BaseY, BaseZ + 1), IntNoise3D(BaseX + 2, BaseY, BaseZ + 1), },
{ IntNoise3D(BaseX - 1, BaseY + 1, BaseZ + 1), IntNoise3D(BaseX, BaseY + 1, BaseZ + 1), IntNoise3D(BaseX + 1, BaseY + 1, BaseZ + 1), IntNoise3D(BaseX + 2, BaseY + 1, BaseZ + 1), },
{ IntNoise3D(BaseX - 1, BaseY + 2, BaseZ + 1), IntNoise3D(BaseX, BaseY + 2, BaseZ + 1), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ + 1), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ + 1), },
};
const NOISE_DATATYPE x3interp1 = CubicInterpolate( points3[0][0], points3[0][1], points3[0][2], points3[0][3], FracX);
const NOISE_DATATYPE x3interp2 = CubicInterpolate( points3[1][0], points3[1][1], points3[1][2], points3[1][3], FracX);
const NOISE_DATATYPE x3interp3 = CubicInterpolate( points3[2][0], points3[2][1], points3[2][2], points3[2][3], FracX);
const NOISE_DATATYPE x3interp4 = CubicInterpolate( points3[3][0], points3[3][1], points3[3][2], points3[3][3], FracX);
const NOISE_DATATYPE x3interp1 = CubicInterpolate(points3[0][0], points3[0][1], points3[0][2], points3[0][3], FracX);
const NOISE_DATATYPE x3interp2 = CubicInterpolate(points3[1][0], points3[1][1], points3[1][2], points3[1][3], FracX);
const NOISE_DATATYPE x3interp3 = CubicInterpolate(points3[2][0], points3[2][1], points3[2][2], points3[2][3], FracX);
const NOISE_DATATYPE x3interp4 = CubicInterpolate(points3[3][0], points3[3][1], points3[3][2], points3[3][3], FracX);
const NOISE_DATATYPE points4[4][4] =
{
{ IntNoise3D( BaseX-1, BaseY-1, BaseZ+2), IntNoise3D( BaseX, BaseY-1, BaseZ+2), IntNoise3D( BaseX+1, BaseY-1, BaseZ+2), IntNoise3D( BaseX+2, BaseY-1, BaseZ+2), },
{ IntNoise3D( BaseX-1, BaseY, BaseZ+2), IntNoise3D( BaseX, BaseY, BaseZ+2), IntNoise3D( BaseX+1, BaseY, BaseZ+2), IntNoise3D( BaseX+2, BaseY, BaseZ+2), },
{ IntNoise3D( BaseX-1, BaseY+1, BaseZ+2), IntNoise3D( BaseX, BaseY+1, BaseZ+2), IntNoise3D( BaseX+1, BaseY+1, BaseZ+2), IntNoise3D( BaseX+2, BaseY+1, BaseZ+2), },
{ IntNoise3D( BaseX-1, BaseY+2, BaseZ+2), IntNoise3D( BaseX, BaseY+2, BaseZ+2), IntNoise3D( BaseX+1, BaseY+2, BaseZ+2), IntNoise3D( BaseX+2, BaseY+2, BaseZ+2), },
{ IntNoise3D(BaseX - 1, BaseY - 1, BaseZ + 2), IntNoise3D(BaseX, BaseY - 1, BaseZ + 2), IntNoise3D(BaseX + 1, BaseY - 1, BaseZ + 2), IntNoise3D(BaseX + 2, BaseY - 1, BaseZ + 2), },
{ IntNoise3D(BaseX - 1, BaseY, BaseZ + 2), IntNoise3D(BaseX, BaseY, BaseZ + 2), IntNoise3D(BaseX + 1, BaseY, BaseZ + 2), IntNoise3D(BaseX + 2, BaseY, BaseZ + 2), },
{ IntNoise3D(BaseX - 1, BaseY + 1, BaseZ + 2), IntNoise3D(BaseX, BaseY + 1, BaseZ + 2), IntNoise3D(BaseX + 1, BaseY + 1, BaseZ + 2), IntNoise3D(BaseX + 2, BaseY + 1, BaseZ + 2), },
{ IntNoise3D(BaseX - 1, BaseY + 2, BaseZ + 2), IntNoise3D(BaseX, BaseY + 2, BaseZ + 2), IntNoise3D(BaseX + 1, BaseY + 2, BaseZ + 2), IntNoise3D(BaseX + 2, BaseY + 2, BaseZ + 2), },
};
const NOISE_DATATYPE x4interp1 = CubicInterpolate( points4[0][0], points4[0][1], points4[0][2], points4[0][3], FracX);
const NOISE_DATATYPE x4interp2 = CubicInterpolate( points4[1][0], points4[1][1], points4[1][2], points4[1][3], FracX);
const NOISE_DATATYPE x4interp3 = CubicInterpolate( points4[2][0], points4[2][1], points4[2][2], points4[2][3], FracX);
const NOISE_DATATYPE x4interp4 = CubicInterpolate( points4[3][0], points4[3][1], points4[3][2], points4[3][3], FracX);
const NOISE_DATATYPE x4interp1 = CubicInterpolate(points4[0][0], points4[0][1], points4[0][2], points4[0][3], FracX);
const NOISE_DATATYPE x4interp2 = CubicInterpolate(points4[1][0], points4[1][1], points4[1][2], points4[1][3], FracX);
const NOISE_DATATYPE x4interp3 = CubicInterpolate(points4[2][0], points4[2][1], points4[2][2], points4[2][3], FracX);
const NOISE_DATATYPE x4interp4 = CubicInterpolate(points4[3][0], points4[3][1], points4[3][2], points4[3][3], FracX);
const NOISE_DATATYPE FracY = (a_Y) - BaseY;
const NOISE_DATATYPE yinterp1 = CubicInterpolate( x1interp1, x1interp2, x1interp3, x1interp4, FracY);
const NOISE_DATATYPE yinterp2 = CubicInterpolate( x2interp1, x2interp2, x2interp3, x2interp4, FracY);
const NOISE_DATATYPE yinterp3 = CubicInterpolate( x3interp1, x3interp2, x3interp3, x3interp4, FracY);
const NOISE_DATATYPE yinterp4 = CubicInterpolate( x4interp1, x4interp2, x4interp3, x4interp4, FracY);
const NOISE_DATATYPE yinterp1 = CubicInterpolate(x1interp1, x1interp2, x1interp3, x1interp4, FracY);
const NOISE_DATATYPE yinterp2 = CubicInterpolate(x2interp1, x2interp2, x2interp3, x2interp4, FracY);
const NOISE_DATATYPE yinterp3 = CubicInterpolate(x3interp1, x3interp2, x3interp3, x3interp4, FracY);
const NOISE_DATATYPE yinterp4 = CubicInterpolate(x4interp1, x4interp2, x4interp3, x4interp4, FracY);
const NOISE_DATATYPE FracZ = (a_Z) - BaseZ;
return CubicInterpolate( yinterp1, yinterp2, yinterp3, yinterp4, FracZ);
return CubicInterpolate(yinterp1, yinterp2, yinterp3, yinterp4, FracZ);
}

View File

@ -13,7 +13,7 @@ public:
void Lock(void);
void Unlock(void);
// IsLocked/IsLockedByCurrentThread are only used in ASSERT statements, but because of the changes with ASSERT they must always be defined
// IsLocked / IsLockedByCurrentThread are only used in ASSERT statements, but because of the changes with ASSERT they must always be defined
// The fake versions (in Release) will not effect the program in any way
#ifdef _DEBUG
cCriticalSection(void);

View File

@ -62,7 +62,7 @@ public:
{
fmRead, // Read-only. If the file doesn't exist, object will not be valid
fmWrite, // Write-only. If the file already exists, it will be overwritten
fmReadWrite, // Read/write. If the file already exists, it will be left intact; writing will overwrite the data from the beginning
fmReadWrite, // Read / write. If the file already exists, it will be left intact; writing will overwrite the data from the beginning
fmAppend // Write-only. If the file already exists cursor will be moved to the end of the file
} ;

View File

@ -162,7 +162,7 @@ public:
/** Returns the local port to which the underlying socket is bound. */
virtual UInt16 GetPort(void) const = 0;
/** Sends the specified payload in a single UDP datagram to the specified host+port combination.
/** Sends the specified payload in a single UDP datagram to the specified host + port combination.
Note that in order to send to a broadcast address, you need to call EnableBroadcasts() first. */
virtual bool Send(const AString & a_Payload, const AString & a_Host, UInt16 a_Port) = 0;

View File

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

View File

@ -68,7 +68,7 @@ const AString & cChunkDataSerializer::Serialize(int a_Version, int a_ChunkX, int
void cChunkDataSerializer::Serialize29(AString & a_Data)
{
// TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib *can* stream)
// TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib can stream)
const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width;
const int MetadataOffset = sizeof(m_BlockTypes);
@ -126,7 +126,7 @@ void cChunkDataSerializer::Serialize29(AString & a_Data)
void cChunkDataSerializer::Serialize39(AString & a_Data)
{
// TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib *can* stream)
// TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib can stream)
const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width;
const int MetadataOffset = sizeof(m_BlockTypes);

View File

@ -659,7 +659,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery)
a_NamesToQuery.erase(a_NamesToQuery.begin(), itr);
Json::FastWriter Writer;
AString RequestBody = Writer.write(root);
// Create the HTTP request:
AString Request;
Request += "POST " + m_NameToUUIDAddress + " HTTP/1.0\r\n"; // We need to use HTTP 1.0 because we don't handle Chunked transfer encoding
@ -667,7 +667,7 @@ void cMojangAPI::QueryNamesToUUIDs(AStringVector & a_NamesToQuery)
Request += "User-Agent: MCServer\r\n";
Request += "Connection: close\r\n";
Request += "Content-Type: application/json\r\n";
Request += Printf("Content-Length: %u\r\n", (unsigned)RequestBody.length());
Request += Printf("Content-Length: %u\r\n", static_cast<unsigned>(RequestBody.length()));
Request += "\r\n";
Request += RequestBody;

View File

@ -492,7 +492,7 @@ void cProtocol172::SendEntityVelocity(const cEntity & a_Entity)
cPacketizer Pkt(*this, 0x12); // Entity Velocity packet
Pkt.WriteBEUInt32(a_Entity.GetUniqueID());
// 400 = 8000 / 20 ... Conversion from our speed in m/s to 8000 m/tick
// 400 = 8000 / 20 ... Conversion from our speed in m / s to 8000 m / tick
Pkt.WriteBEInt16(static_cast<short>(a_Entity.GetSpeedX() * 400));
Pkt.WriteBEInt16(static_cast<short>(a_Entity.GetSpeedY() * 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
{
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;

View File

@ -479,7 +479,7 @@ void cProtocol180::SendEntityVelocity(const cEntity & a_Entity)
cPacketizer Pkt(*this, 0x12); // Entity Velocity packet
Pkt.WriteVarInt32(a_Entity.GetUniqueID());
// 400 = 8000 / 20 ... Conversion from our speed in m/s to 8000 m/tick
// 400 = 8000 / 20 ... Conversion from our speed in m / s to 8000 m / tick
Pkt.WriteBEInt16((short)(a_Entity.GetSpeedX() * 400));
Pkt.WriteBEInt16((short)(a_Entity.GetSpeedY() * 400));
Pkt.WriteBEInt16((short)(a_Entity.GetSpeedZ() * 400));
@ -2754,7 +2754,7 @@ void cProtocol180::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata)
for (int loretag = NBT.GetFirstChild(displaytag); loretag >= 0; loretag = NBT.GetNextSibling(loretag)) // Loop through array of strings
{
AppendPrintf(Lore, "%s`", NBT.GetString(loretag).c_str()); // Append the lore with a grave accent/backtick, used internally by MCS to display a new line in the client; don't forget to c_str ;)
AppendPrintf(Lore, "%s`", NBT.GetString(loretag).c_str()); // Append the lore with a grave accent / backtick, used internally by MCS to display a new line in the client; don't forget to c_str ;)
}
a_Item.m_Lore = Lore;

View File

@ -2153,7 +2153,7 @@ void cRankManager::ClearPlayerRanks(void)
}
catch (SQLite::Exception & ex)
{
LOGWARNING("%s: Failed to remove/clear all players: %s", __FUNCTION__, ex.what());
LOGWARNING("%s: Failed to remove / clear all players: %s", __FUNCTION__, ex.what());
}
}

View File

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

View File

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

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);
@ -471,7 +471,7 @@ cObjective * cScoreboard::GetObjectiveIn(eDisplaySlot a_Slot)
bool cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback& a_Callback)
bool cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallback & a_Callback)
{
cCSLock Lock(m_CSObjectives);
@ -493,7 +493,7 @@ bool cScoreboard::ForEachObjectiveWith(cObjective::eType a_Type, cObjectiveCallb
bool cScoreboard::ForEachObjective(cObjectiveCallback& a_Callback)
bool cScoreboard::ForEachObjective(cObjectiveCallback & a_Callback)
{
cCSLock Lock(m_CSObjectives);
@ -512,7 +512,7 @@ bool cScoreboard::ForEachObjective(cObjectiveCallback& a_Callback)
bool cScoreboard::ForEachTeam(cTeamCallback& a_Callback)
bool cScoreboard::ForEachTeam(cTeamCallback & a_Callback)
{
cCSLock Lock(m_CSTeams);

View File

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

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. */
bool CheckNeighborsForSource(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ);
/** Checks if the specified block should harden (Water/Lava interaction) and if so, converts it to a suitable block.
/** Checks if the specified block should harden (Water / Lava interaction) and if so, converts it to a suitable block.
Returns whether the block was changed or not. */
bool HardenBlock(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta);

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 (
IsMechanism(Type) && // Is it a mechanism? Not block/other torch etc.
IsMechanism(Type) && // Is it a mechanism? Not block / other torch etc.
(!Vector3i(a_RelBlockX + gCrossCoords[i].x, a_RelBlockY + gCrossCoords[i].y, a_RelBlockZ + gCrossCoords[i].z).Equals(Vector3i(X, Y, Z))) // CAN'T power block is that it is on
)
{
@ -1600,7 +1600,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB
if ((OtherRepeaterDir & 0x03) == 0x3)
{
return true;
} // If so, I am latched/locked
} // If so, I am latched / locked
}
// Check if western(left) neighbor is a powered on repeater who is facing us
@ -1612,7 +1612,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB
if ((OtherRepeaterDir & 0x03) == 0x1)
{
return true;
} // If so, I am latched/locked
} // If so, I am latched / locked
}
break;
@ -1634,7 +1634,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB
if ((OtherRepeaterDir & 0x30) == 0x00)
{
return true;
} // If so, am latched/locked
} // If so, I am latched / locked
}
// Check if northern(up) neighbor is a powered on repeater who is facing us
@ -1646,7 +1646,7 @@ bool cIncrementalRedstoneSimulator::IsRepeaterLocked(int a_RelBlockX, int a_RelB
if ((OtherRepeaterDir & 0x03) == 0x02)
{
return true;
} // If so, I am latched/locked
} // If so, I am latched / locked
}
break;

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()]. */
extern size_t RateCompareString(const AString & s1, const AString & s2);
/** Replaces *each* occurence of iNeedle in iHayStack with iReplaceWith */
/** Replaces each occurence of iNeedle in iHayStack with iReplaceWith */
extern void ReplaceString(AString & iHayStack, const AString & iNeedle, const AString & iReplaceWith); // tolua_export
/** Converts a stream of BE shorts into UTF-8 string; returns a_UTF8. */

View File

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

View File

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

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