summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-17 19:13:23 +0200
committermadmaxoft <github@xoft.cz>2014-07-17 19:13:23 +0200
commit7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4 (patch)
tree54a0e32d887554b1131c8c9123027f16a7faf5d8 /src
parentFixed basic whitespace problems. (diff)
downloadcuberite-7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4.tar
cuberite-7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4.tar.gz
cuberite-7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4.tar.bz2
cuberite-7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4.tar.lz
cuberite-7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4.tar.xz
cuberite-7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4.tar.zst
cuberite-7fff12bfacbb4bef1c02cea0ec10fdc9a6fb64e4.zip
Diffstat (limited to 'src')
-rw-r--r--src/BlockID.h2
-rw-r--r--src/BlockInfo.h2
-rw-r--r--src/Chunk.cpp22
-rw-r--r--src/Chunk.h1
-rw-r--r--src/ChunkDef.h4
-rw-r--r--src/ChunkMap.cpp23
-rw-r--r--src/ClientHandle.cpp24
-rw-r--r--src/ClientHandle.h16
-rw-r--r--src/CraftingRecipes.cpp2
-rw-r--r--src/Defines.h2
-rw-r--r--src/FurnaceRecipe.cpp8
-rw-r--r--src/Globals.h22
-rw-r--r--src/GroupManager.cpp2
-rw-r--r--src/Inventory.cpp4
-rw-r--r--src/Log.cpp4
-rw-r--r--src/Map.h2
-rw-r--r--src/MapManager.h6
-rw-r--r--src/Matrix4.h2
-rw-r--r--src/MobCensus.cpp2
-rw-r--r--src/MobFamilyCollecter.h2
-rw-r--r--src/MobProximityCounter.cpp4
-rw-r--r--src/MobSpawner.h2
-rw-r--r--src/Root.cpp6
-rw-r--r--src/Scoreboard.h6
-rw-r--r--src/Server.cpp6
-rw-r--r--src/Server.h6
-rw-r--r--src/Statistics.h4
-rw-r--r--src/Tracer.cpp24
-rw-r--r--src/Vector3.h2
-rw-r--r--src/WebAdmin.cpp2
-rw-r--r--src/WebAdmin.h8
-rw-r--r--src/World.cpp32
-rw-r--r--src/World.h8
-rw-r--r--src/main.cpp18
34 files changed, 141 insertions, 139 deletions
diff --git a/src/BlockID.h b/src/BlockID.h
index 43f911ce3..4246c0bc9 100644
--- a/src/BlockID.h
+++ b/src/BlockID.h
@@ -171,7 +171,7 @@ enum ENUM_BLOCK_ID
E_BLOCK_DROPPER = 158,
E_BLOCK_STAINED_CLAY = 159,
E_BLOCK_STAINED_GLASS_PANE = 160,
- E_BLOCK_NEW_LEAVES = 161, // Acacia and Dark Oak IDs in Minecraft 1.7.x
+ E_BLOCK_NEW_LEAVES = 161, // Acacia and Dark Oak IDs in Minecraft 1.7.x
E_BLOCK_NEW_LOG = 162,
E_BLOCK_ACACIA_WOOD_STAIRS = 163,
E_BLOCK_DARK_OAK_WOOD_STAIRS = 164,
diff --git a/src/BlockInfo.h b/src/BlockInfo.h
index d6d4e7430..ed6fd4754 100644
--- a/src/BlockInfo.h
+++ b/src/BlockInfo.h
@@ -81,7 +81,7 @@ protected:
/** Initializes the specified BlockInfo structures with block-specific values. */
static void Initialize(cBlockInfoArray & a_BlockInfos);
-}; // tolua_export
+}; // tolua_export
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index b88952fa0..2d8ff7714 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -448,7 +448,7 @@ void cChunk::CollectMobCensus(cMobCensus& toFill)
Vector3d currentPosition;
for (cEntityList::iterator 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())
{
cMonster& Monster = (cMonster&)(**itr);
@@ -698,13 +698,13 @@ void cChunk::ProcessQueuedSetBlocks(void)
{
if (itr->m_Tick <= CurrTick)
{
- if (itr->m_PreviousType != E_BLOCK_AIR) // PreviousType defaults to 0 if not specified
+ if (itr->m_PreviousType != E_BLOCK_AIR) // PreviousType defaults to 0 if not specified
{
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
// 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);
LOGD("Successfully set queued block - previous and current types matched");
}
@@ -810,7 +810,7 @@ void cChunk::TickBlocks(void)
if (m_BlockTickY > cChunkDef::GetHeight(m_HeightMap, m_BlockTickX, m_BlockTickZ))
{
- continue; // It's all air up here
+ continue; // It's all air up here
}
cBlockHandler * Handler = BlockHandler(GetBlock(m_BlockTickX, m_BlockTickY, m_BlockTickZ));
@@ -1530,11 +1530,11 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT
m_ChunkData.SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType);
- if ( // Queue block to be sent only if ...
- a_SendToClients && // ... we are told to do so AND ...
+ if ( // Queue block to be sent only if ...
+ a_SendToClients && // ... we are told to do so AND ...
(
- (OldBlockMeta != a_BlockMeta) || // ... the meta value is different OR ...
- !( // ... the old and new blocktypes AREN'T liquids (because client doesn't need to distinguish betwixt them); see below for specifics:
+ (OldBlockMeta != a_BlockMeta) || // ... the meta value is different OR ...
+ !( // ... the old and new blocktypes AREN'T liquids (because client doesn't need to distinguish betwixt them); see below for specifics:
((OldBlockType == E_BLOCK_STATIONARY_WATER) && (a_BlockType == E_BLOCK_WATER)) || // Replacing stationary water with water
((OldBlockType == E_BLOCK_WATER) && (a_BlockType == E_BLOCK_STATIONARY_WATER)) || // Replacing water with stationary water
((OldBlockType == E_BLOCK_STATIONARY_LAVA) && (a_BlockType == E_BLOCK_LAVA)) || // Replacing stationary water with water
@@ -1727,7 +1727,7 @@ void cChunk::CollectPickupsByPlayer(cPlayer * a_Player)
{
if ((!(*itr)->IsPickup()) && (!(*itr)->IsProjectile()))
{
- continue; // Only pickups and projectiles
+ continue; // Only pickups and projectiles can be picked up
}
float DiffX = (float)((*itr)->GetPosX() - PosX );
float DiffY = (float)((*itr)->GetPosY() - PosY );
@@ -2152,7 +2152,7 @@ bool cChunk::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallb
{
continue;
}
- if (((*itr)->GetBlockType() != E_BLOCK_CHEST) && ((*itr)->GetBlockType() != E_BLOCK_TRAPPED_CHEST)) // Trapped chests use normal chests' handlers
+ if (((*itr)->GetBlockType() != E_BLOCK_CHEST) && ((*itr)->GetBlockType() != E_BLOCK_TRAPPED_CHEST)) // Trapped chests use normal chests' handlers
{
// There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out
return false;
@@ -2481,7 +2481,7 @@ BLOCKTYPE cChunk::GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
)
{
ASSERT(!"GetBlock(x, y, z) out of bounds!");
- return 0; // Clip
+ return 0; // Clip
}
return m_ChunkData.GetBlock(a_RelX, a_RelY, a_RelZ);
diff --git a/src/Chunk.h b/src/Chunk.h
index f765bcdaf..2e2895c6e 100644
--- a/src/Chunk.h
+++ b/src/Chunk.h
@@ -274,7 +274,6 @@ public:
void UseBlockEntity(cPlayer * a_Player, int a_X, int a_Y, int a_Z); // [x, y, z] in world block coords
- void CalculateLighting(); // Recalculate right now
void CalculateHeightmap(const BLOCKTYPE * a_BlockTypes);
// Broadcast various packets to all clients of this chunk:
diff --git a/src/ChunkDef.h b/src/ChunkDef.h
index bd6387b74..334f8a6b9 100644
--- a/src/ChunkDef.h
+++ b/src/ChunkDef.h
@@ -138,9 +138,9 @@ public:
{
#if AXIS_ORDER == AXIS_ORDER_XZY
// For some reason, NOT using the Horner schema is faster. Weird.
- return x + (z * cChunkDef::Width) + (y * cChunkDef::Width * cChunkDef::Width); // 1.2 is XZY
+ return x + (z * cChunkDef::Width) + (y * cChunkDef::Width * cChunkDef::Width); // 1.2 uses XZY
#elif AXIS_ORDER == AXIS_ORDER_YZX
- return y + (z * cChunkDef::Width) + (x * cChunkDef::Height * cChunkDef::Width); // 1.1 is YZX
+ return y + (z * cChunkDef::Width) + (x * cChunkDef::Height * cChunkDef::Width); // 1.1 uses YZX
#endif
}
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index a83828bed..de2016015 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -20,7 +20,7 @@
#include "Entities/Pickup.h"
#ifndef _WIN32
- #include <cstdlib> // abs
+ #include <cstdlib> // abs
#endif
#include "zlib/zlib.h"
@@ -33,14 +33,15 @@
////////////////////////////////////////////////////////////////////////////////
// cChunkMap:
-cChunkMap::cChunkMap(cWorld * a_World )
- : m_World( a_World ),
+cChunkMap::cChunkMap(cWorld * a_World) :
+ m_World(a_World),
m_Pool(
new cListAllocationPool<cChunkData::sChunkSection, 1600>(
std::auto_ptr<cAllocationPool<cChunkData::sChunkSection>::cStarvationCallbacks>(
- new cStarvationCallbacks())
+ new cStarvationCallbacks()
)
)
+ )
{
}
@@ -1873,15 +1874,15 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
default:
{
- if (m_World->GetTickRandomNumber(100) <= 25) // 25% chance of pickups
+ if (m_World->GetTickRandomNumber(100) <= 25) // 25% chance of pickups
{
cItems Drops;
cBlockHandler * Handler = BlockHandler(Block);
- Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); // Stone becomes cobblestone, coal ore becomes coal, etc.
+ Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); // Stone becomes cobblestone, coal ore becomes coal, etc.
m_World->SpawnItemPickups(Drops, bx + x, by + y, bz + z);
}
- else if ((m_World->GetTNTShrapnelLevel() > slNone) && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around
+ else if ((m_World->GetTNTShrapnelLevel() > slNone) && (m_World->GetTickRandomNumber(100) < 20)) // 20% chance of flinging stuff around
{
if (!cBlockInfo::FullyOccupiesVoxel(Block))
{
@@ -1921,7 +1922,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
{
if (a_Entity->IsPickup())
{
- if (((cPickup *)a_Entity)->GetAge() < 20) // If pickup age is smaller than one second, it is invincible (so we don't kill pickups that were just spawned)
+ if (((cPickup *)a_Entity)->GetAge() < 20) // If pickup age is smaller than one second, it is invincible (so we don't kill pickups that were just spawned)
{
return false;
}
@@ -1930,7 +1931,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
Vector3d EntityPos = a_Entity->GetPosition();
cBoundingBox bbEntity(EntityPos, a_Entity->GetWidth() / 2, a_Entity->GetHeight());
- if (!m_bbTNT.IsInside(bbEntity)) // IsInside actually acts like DoesSurround
+ if (!m_bbTNT.IsInside(bbEntity)) // IsInside actually acts like DoesSurround
{
return false;
}
@@ -1953,7 +1954,7 @@ void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_
else if (FinalDamage < 0)
FinalDamage = 0;
- if (!a_Entity->IsTNT() && !a_Entity->IsFallingBlock()) // Don't apply damage to other TNT entities and falling blocks, they should be invincible
+ if (!a_Entity->IsTNT() && !a_Entity->IsFallingBlock()) // Don't apply damage to other TNT entities and falling blocks, they should be invincible
{
a_Entity->TakeDamage(dtExplosion, NULL, (int)FinalDamage, 0);
}
@@ -2733,7 +2734,7 @@ cChunkMap::cChunkLayer::~cChunkLayer()
for (size_t i = 0; i < ARRAYCOUNT(m_Chunks); ++i)
{
delete m_Chunks[i];
- m_Chunks[i] = NULL; // // Must zero out, because further chunk deletions query the chunkmap for entities and that would touch deleted data
+ m_Chunks[i] = NULL; // Must zero out, because further chunk deletions query the chunkmap for entities and that would touch deleted data
} // for i - m_Chunks[]
}
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index bf66e7db1..afa99008a 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -589,7 +589,7 @@ void cClientHandle::HandleCreativeInventory(short a_SlotNum, const cItem & a_Hel
void cClientHandle::HandlePlayerAbilities(bool a_CanFly, bool a_IsFlying, float FlyingSpeed, float WalkingSpeed)
{
- UNUSED(FlyingSpeed); // Ignore the client values for these
+ UNUSED(FlyingSpeed); // Ignore the client values for these
UNUSED(WalkingSpeed);
m_Player->SetCanFly(a_CanFly);
@@ -668,7 +668,7 @@ void cClientHandle::HandlePluginMessage(const AString & a_Channel, const AString
if (HasPluginChannel(a_Channel))
{
SendPluginMessage("UNREGISTER", a_Channel);
- return; // Can't register again if already taken - kinda defeats the point of plugin messaging!
+ return; // Can't register again if already taken - kinda defeats the point of plugin messaging!
}
RegisterPluginChannels(BreakApartPluginChannels(a_Message));
@@ -842,7 +842,7 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB
}
if (
- ((a_Status == DIG_STATUS_STARTED) || (a_Status == DIG_STATUS_FINISHED)) && // Only do a radius check for block destruction - things like pickup tossing send coordinates that are to be ignored
+ ((a_Status == DIG_STATUS_STARTED) || (a_Status == DIG_STATUS_FINISHED)) && // Only do a radius check for block destruction - things like pickup tossing send coordinates that are to be ignored
((Diff(m_Player->GetPosX(), (double)a_BlockX) > 6) ||
(Diff(m_Player->GetPosY(), (double)a_BlockY) > 6) ||
(Diff(m_Player->GetPosZ(), (double)a_BlockZ) > 6))
@@ -926,7 +926,7 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB
// A plugin doesn't agree with the tossing. The plugin itself is responsible for handling the consequences (possible inventory mismatch)
return;
}
- m_Player->TossEquippedItem(64); // Toss entire slot - if there aren't enough items, the maximum will be ejected
+ m_Player->TossEquippedItem(64); // Toss entire slot - if there aren't enough items, the maximum will be ejected
return;
}
@@ -989,7 +989,7 @@ void cClientHandle::HandleBlockDigStarted(int a_BlockX, int a_BlockY, int a_Bloc
int pY = a_BlockY;
int pZ = a_BlockZ;
- AddFaceDirection(pX, pY, pZ, a_BlockFace); // Get the block in front of the clicked coordinates (m_bInverse defaulted to false)
+ AddFaceDirection(pX, pY, pZ, a_BlockFace); // Get the block in front of the clicked coordinates (m_bInverse defaulted to false)
cBlockHandler * Handler = cBlockInfo::GetHandler(m_Player->GetWorld()->GetBlock(pX, pY, pZ));
if (Handler->IsClickedThrough())
@@ -1083,7 +1083,7 @@ void cClientHandle::HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_Blo
void cClientHandle::FinishDigAnimation()
{
- if (!m_HasStartedDigging) // Hasn't received the DIG_STARTED packet
+ if (!m_HasStartedDigging) // Hasn't received the DIG_STARTED packet
{
return;
}
@@ -1441,23 +1441,25 @@ void cClientHandle::HandleAnimation(char a_Animation)
// Because the animation ID sent to servers by clients are different to those sent back, we need this
switch (a_Animation)
{
- case 0: // No animation - wiki.vg doesn't say that client has something specific for it, so I suppose it will just become -1
+ case 0: // No animation - wiki.vg doesn't say that client has something specific for it, so I suppose it will just become -1
case 1:
case 2:
case 3:
{
- a_Animation--; // Offset by -1
+ a_Animation--; // Offset by -1
break;
}
case 5:
case 6:
case 7:
{
- a_Animation -= 2; // Offset by -2
+ a_Animation -= 2; // Offset by -2
break;
}
- default: // Anything else is the same
+ default: // Anything else is the same
+ {
break;
+ }
}
m_Player->GetWorld()->BroadcastEntityAnimation(*m_Player, a_Animation, this);
@@ -2473,7 +2475,7 @@ void cClientHandle::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType,
-void cClientHandle::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) // VehicleSubType is specific to Minecarts
+void cClientHandle::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) // VehicleSubType is specific to Minecarts
{
m_Protocol->SendSpawnVehicle(a_Vehicle, a_VehicleType, a_VehicleSubType);
}
diff --git a/src/ClientHandle.h b/src/ClientHandle.h
index d02b83cfe..539e24ef6 100644
--- a/src/ClientHandle.h
+++ b/src/ClientHandle.h
@@ -123,7 +123,7 @@ public:
void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle);
void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType);
void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage);
- void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_export
+ void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_export
void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes);
void SendChat (const AString & a_Message, eMessageType a_ChatPrefix, const AString & a_AdditionalData = "");
void SendChat (const cCompositeChat & a_Message);
@@ -271,15 +271,14 @@ public:
private:
- /** Handles the block placing packet when it is a real block placement (not block-using, item-using or eating) */
- void HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, cItemHandler & a_ItemHandler);
-
/** The type used for storing the names of registered plugin channels. */
typedef std::set<AString> cChannels;
- int m_ViewDistance; // Number of chunks the player can see in each direction; 4 is the minimum ( http://wiki.vg/Protocol_FAQ#.E2.80.A6all_connecting_clients_spasm_and_jerk_uncontrollably.21 )
+ /** Number of chunks the player can see in each direction; 4 is the minimum ( http://wiki.vg/Protocol_FAQ#.E2.80.A6all_connecting_clients_spasm_and_jerk_uncontrollably.21 ) */
+ int m_ViewDistance;
- static const int GENERATEDISTANCE = 2; // Server generates this many chunks AHEAD of player sight. 2 is the minimum, since foliage is generated 1 step behind chunk terrain generation
+ /** Server generates this many chunks AHEAD of player sight. */
+ static const int GENERATEDISTANCE = 2;
AString m_IPString;
@@ -317,7 +316,7 @@ private:
int m_PingID;
long long m_PingStartTime;
long long m_LastPingTime;
- static const unsigned short PING_TIME_MS = 1000; //minecraft sends 1 per 20 ticks (1 second or every 1000 ms)
+ static const unsigned short PING_TIME_MS = 1000; // Vanilla sends 1 per 20 ticks (1 second or every 1000 ms)
// Values required for block dig animation
int m_BlockDigAnimStage; // Current stage of the animation; -1 if not digging
@@ -374,6 +373,9 @@ private:
cChannels m_PluginChannels;
+ /** Handles the block placing packet when it is a real block placement (not block-using, item-using or eating) */
+ void HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, cItemHandler & a_ItemHandler);
+
/** Returns true if the rate block interactions is within a reasonable limit (bot protection) */
bool CheckBlockInteractionsRate(void);
diff --git a/src/CraftingRecipes.cpp b/src/CraftingRecipes.cpp
index a2ce359f3..e9946160f 100644
--- a/src/CraftingRecipes.cpp
+++ b/src/CraftingRecipes.cpp
@@ -838,7 +838,7 @@ void cCraftingRecipes::HandleFireworks(const cItem * a_CraftingGrid, cCraftingRe
case E_ITEM_GOLD_NUGGET: a_Recipe->m_Result.m_FireworkItem.m_Type = 2; break;
case E_ITEM_FEATHER: a_Recipe->m_Result.m_FireworkItem.m_Type = 4; break;
case E_ITEM_HEAD: a_Recipe->m_Result.m_FireworkItem.m_Type = 3; break;
- default: LOG("Unexpected item in firework star recipe, was the crafting file's fireworks section changed?"); break; // ermahgerd BARD ardmins
+ default: LOG("Unexpected item in firework star recipe, was the crafting file's fireworks section changed?"); break; // ermahgerd BARD ardmins
}
}
diff --git a/src/Defines.h b/src/Defines.h
index ba2e8f504..877970ab8 100644
--- a/src/Defines.h
+++ b/src/Defines.h
@@ -22,7 +22,7 @@ typedef std::vector<int> cSlotNums;
/// Experience Orb setup
enum
{
- //open to suggestion on naming convention here :)
+ // Open to suggestion on naming convention here :)
MAX_EXPERIENCE_ORB_SIZE = 2000
} ;
diff --git a/src/FurnaceRecipe.cpp b/src/FurnaceRecipe.cpp
index 8add9610c..cf29e227f 100644
--- a/src/FurnaceRecipe.cpp
+++ b/src/FurnaceRecipe.cpp
@@ -107,7 +107,7 @@ void cFurnaceRecipe::AddFuelFromLine(const AString & a_Line, int a_LineNum)
{
// Fuel
int IItemID = 0, IItemCount = 0, IItemHealth = 0, IBurnTime = 0;
- AString::size_type BeginPos = 1; // Begin at one after exclamation mark (bang)
+ AString::size_type BeginPos = 1; // Begin at one after exclamation mark (bang)
if (
!ReadMandatoryNumber(BeginPos, ":", a_Line, a_LineNum, IItemID) || // Read item ID
@@ -133,7 +133,7 @@ void cFurnaceRecipe::AddRecipeFromLine(const AString & a_Line, int a_LineNum)
{
int IItemID = 0, IItemCount = 0, IItemHealth = 0, IBurnTime = 0;
int OItemID = 0, OItemCount = 0, OItemHealth = 0;
- AString::size_type BeginPos = 0; // Begin at start of line
+ AString::size_type BeginPos = 0; // Begin at start of line
if (
!ReadMandatoryNumber(BeginPos, ":", a_Line, a_LineNum, IItemID) || // Read item ID
@@ -193,7 +193,7 @@ bool cFurnaceRecipe::ReadMandatoryNumber(AString::size_type & a_Begin, const ASt
}
a_Value = atoi(a_Text.substr(a_Begin, End - a_Begin).c_str());
- a_Begin = End + 1; // Jump over delimiter
+ a_Begin = End + 1; // Jump over delimiter
return true;
}
@@ -236,7 +236,7 @@ bool cFurnaceRecipe::ReadOptionalNumbers(AString::size_type & a_Begin, const ASt
}
a_ValueTwo = atoi(a_Text.substr(Begin, End - Begin).c_str());
- a_Begin = End + 1; // Jump over delimiter
+ a_Begin = End + 1; // Jump over delimiter
return true;
}
else
diff --git a/src/Globals.h b/src/Globals.h
index 62e0ad285..9b2f25f36 100644
--- a/src/Globals.h
+++ b/src/Globals.h
@@ -14,18 +14,18 @@
#pragma warning(disable:4481)
// Disable some warnings that we don't care about:
- #pragma warning(disable:4100) // Unreferenced formal parameter
+ #pragma warning(disable:4100) // Unreferenced formal parameter
// Useful warnings from warning level 4:
- #pragma warning(3 : 4127) // Conditional expression is constant
- #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 : 4310) // Cast truncates constant value
- #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
- #pragma warning(3 : 4706) // Assignment within conditional expression
+ #pragma warning(3 : 4127) // Conditional expression is constant
+ #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 : 4310) // Cast truncates constant value
+ #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
+ #pragma warning(3 : 4706) // Assignment within conditional expression
// Disabling this warning, because we know what we're doing when we're doing this:
#pragma warning(disable: 4355) // 'this' used in initializer list
@@ -34,7 +34,7 @@
#pragma warning(disable: 4512) // 'class': assignment operator could not be generated - reported for each class that has a reference-type member
// 2014_01_06 xoft: Disabled this warning because MSVC is stupid and reports it in obviously wrong places
- // #pragma warning(3 : 4244) // Conversion from 'type1' to 'type2', possible loss of data
+ // #pragma warning(3 : 4244) // Conversion from 'type1' to 'type2', possible loss of data
#define OBSOLETE __declspec(deprecated)
diff --git a/src/GroupManager.cpp b/src/GroupManager.cpp
index 11e62c223..ffba68200 100644
--- a/src/GroupManager.cpp
+++ b/src/GroupManager.cpp
@@ -145,7 +145,7 @@ bool cGroupManager::LoadGroups()
AString KeyName = IniFile.GetKeyName(i);
cGroup * Group = GetGroup(KeyName.c_str());
- Group->ClearPermission(); // Needed in case the groups are reloaded.
+ Group->ClearPermission(); // Needed in case the groups are reloaded.
LOGD("Loading group %s", KeyName.c_str());
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index bce882c88..38d3c886d 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -493,7 +493,7 @@ bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size,
if( NumFree >= a_Item.m_ItemCount )
{
- //printf("1. Adding %i items ( free: %i )\n", a_Item.m_ItemCount, NumFree );
+ // printf("1. Adding %i items ( free: %i )\n", a_Item.m_ItemCount, NumFree );
m_Slots[i + a_Offset].m_ItemCount += a_Item.m_ItemCount;
a_Item.m_ItemCount = 0;
a_bChangedSlots[i + a_Offset] = true;
@@ -501,7 +501,7 @@ bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size,
}
else
{
- //printf("2. Adding %i items\n", NumFree );
+ // printf("2. Adding %i items\n", NumFree );
m_Slots[i + a_Offset].m_ItemCount += (char)NumFree;
a_Item.m_ItemCount -= (char)NumFree;
a_bChangedSlots[i + a_Offset] = true;
diff --git a/src/Log.cpp b/src/Log.cpp
index a7be04b1a..d96e3e9e4 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -130,9 +130,9 @@ void cLog::Log(const char * a_Format, va_list argList)
// Print to console:
#if defined(ANDROID_NDK)
- //__android_log_vprint(ANDROID_LOG_ERROR,"MCServer", a_Format, argList);
+ // __android_log_vprint(ANDROID_LOG_ERROR,"MCServer", a_Format, argList);
__android_log_print(ANDROID_LOG_ERROR, "MCServer", "%s", Line.c_str() );
- //CallJavaFunction_Void_String(g_JavaThread, "AddToLog", Line );
+ // CallJavaFunction_Void_String(g_JavaThread, "AddToLog", Line );
#else
printf("%s", Line.c_str());
#endif
diff --git a/src/Map.h b/src/Map.h
index 6bb2d62c6..fe324a5e7 100644
--- a/src/Map.h
+++ b/src/Map.h
@@ -256,7 +256,7 @@ private:
friend class cMapSerializer;
-}; // tolua_export
+}; // tolua_export
diff --git a/src/MapManager.h b/src/MapManager.h
index 3cd6c08cd..a40ec2630 100644
--- a/src/MapManager.h
+++ b/src/MapManager.h
@@ -43,14 +43,14 @@ public:
Returns true if the map was found and the callback called, false if map not found.
Callback return value is ignored.
*/
- bool DoWithMap(int a_ID, cMapCallback & a_Callback); // Exported in ManualBindings.cpp
+ bool DoWithMap(int a_ID, cMapCallback & a_Callback); // Exported in ManualBindings.cpp
/** Calls the callback for each map.
Returns true if all maps processed, false if the callback aborted by returning true.
*/
bool ForEachMap(cMapCallback & a_Callback);
- size_t GetNumMaps(void) const; // tolua_export
+ size_t GetNumMaps(void) const; // tolua_export
/** Loads the map data from the disk */
void LoadMapData(void);
@@ -69,7 +69,7 @@ private:
cWorld * m_World;
-}; // tolua_export
+}; // tolua_export
diff --git a/src/Matrix4.h b/src/Matrix4.h
index 557057aca..081847b9f 100644
--- a/src/Matrix4.h
+++ b/src/Matrix4.h
@@ -3,7 +3,7 @@
-#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC)
+#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC)
#include <math.h>
diff --git a/src/MobCensus.cpp b/src/MobCensus.cpp
index d5a341ef7..4109aff07 100644
--- a/src/MobCensus.cpp
+++ b/src/MobCensus.cpp
@@ -19,7 +19,7 @@ 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
+ 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
// MG TODO : code the correct count
if ((GetCapMultiplier(a_MobFamily) * GetNumChunks()) / ratio >= m_MobFamilyCollecter.GetNumberOfCollectedMobs(a_MobFamily))
diff --git a/src/MobFamilyCollecter.h b/src/MobFamilyCollecter.h
index 362814c8f..c4324bd68 100644
--- a/src/MobFamilyCollecter.h
+++ b/src/MobFamilyCollecter.h
@@ -4,7 +4,7 @@
#include <map>
#include <set>
#include "BlockID.h"
-#include "Mobs/Monster.h" //this is a side-effect of keeping Mobfamily inside Monster class. I'd prefer to keep both (Mobfamily and Monster) inside a "Monster" namespace MG TODO : do it
+#include "Mobs/Monster.h" // This is a side-effect of keeping Mobfamily inside Monster class. I'd prefer to keep both (Mobfamily and Monster) inside a "Monster" namespace MG TODO : do it
diff --git a/src/MobProximityCounter.cpp b/src/MobProximityCounter.cpp
index 35bf57380..a89fa72df 100644
--- a/src/MobProximityCounter.cpp
+++ b/src/MobProximityCounter.cpp
@@ -61,7 +61,7 @@ cMobProximityCounter::sIterablePair cMobProximityCounter::getMobWithinThosesDist
{
if ((a_DistanceMin == 1) || (itr->first > a_DistanceMin))
{
- toReturn.m_Begin = itr; // this is the first one with distance > a_DistanceMin;
+ toReturn.m_Begin = itr; // This is the first one with distance > a_DistanceMin;
}
}
@@ -69,7 +69,7 @@ cMobProximityCounter::sIterablePair cMobProximityCounter::getMobWithinThosesDist
{
if ((a_DistanceMax != 1) && (itr->first > a_DistanceMax))
{
- toReturn.m_End = itr; // this is just after the last one with distance < a_DistanceMax
+ toReturn.m_End = itr; // This is just after the last one with distance < a_DistanceMax
// Note : if we are not going through this, it's ok, toReturn.m_End will be end();
break;
}
diff --git a/src/MobSpawner.h b/src/MobSpawner.h
index aa2935916..f3c56fe2d 100644
--- a/src/MobSpawner.h
+++ b/src/MobSpawner.h
@@ -6,7 +6,7 @@
#include "ChunkDef.h"
#include "Chunk.h"
#include "FastRandom.h"
-#include "Mobs/Monster.h" //this is a side-effect of keeping Mobfamily inside Monster class. I'd prefer to keep both (Mobfamily and Monster) inside a "Monster" namespace MG TODO : do it
+#include "Mobs/Monster.h" // This is a side-effect of keeping Mobfamily inside Monster class. I'd prefer to keep both (Mobfamily and Monster) inside a "Monster" namespace MG TODO : do it
diff --git a/src/Root.cpp b/src/Root.cpp
index 235a1b108..6347adcf0 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -105,7 +105,7 @@ void cRoot::Start(void)
#ifdef _WIN32
HWND hwnd = GetConsoleWindow();
HMENU hmenu = GetSystemMenu(hwnd, FALSE);
- EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED); // Disable close button when starting up; it causes problems with our CTRL-CLOSE handling
+ EnableMenuItem(hmenu, SC_CLOSE, MF_GRAYED); // Disable close button when starting up; it causes problems with our CTRL-CLOSE handling
#endif
cDeadlockDetect dd;
@@ -202,7 +202,7 @@ void cRoot::Start(void)
LOG("Startup complete, took %lld ms!", finishmseconds);
#ifdef _WIN32
- EnableMenuItem(hmenu, SC_CLOSE, MF_ENABLED); // Re-enable close button
+ EnableMenuItem(hmenu, SC_CLOSE, MF_ENABLED); // Re-enable close button
#endif
while (!m_bStop && !m_bRestart && !g_TERMINATE_EVENT_RAISED) // These are modified by external threads
@@ -607,7 +607,7 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac
m_BestRating = Rating;
++m_NumMatches;
}
- if (Rating == m_NameLength) // Perfect match
+ if (Rating == m_NameLength) // Perfect match
{
return true;
}
diff --git a/src/Scoreboard.h b/src/Scoreboard.h
index 5f91535f8..f53b8c803 100644
--- a/src/Scoreboard.h
+++ b/src/Scoreboard.h
@@ -118,7 +118,7 @@ private:
friend class cScoreboardSerializer;
-}; // tolua_export
+}; // tolua_export
@@ -197,7 +197,7 @@ private:
friend class cScoreboardSerializer;
-}; // tolua_export
+}; // tolua_export
@@ -301,7 +301,7 @@ private:
friend class cScoreboardSerializer;
-}; // tolua_export
+}; // tolua_export
diff --git a/src/Server.cpp b/src/Server.cpp
index 17551eeb1..81ecd38b2 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -202,7 +202,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
m_PlayerCount = 0;
m_PlayerCountDiff = 0;
- m_FaviconData = Base64Encode(cFile::ReadWholeFile(FILE_IO_PREFIX + AString("favicon.png"))); // Will return empty string if file nonexistant; client doesn't mind
+ m_FaviconData = Base64Encode(cFile::ReadWholeFile(FILE_IO_PREFIX + AString("favicon.png"))); // Will return empty string if file nonexistant; client doesn't mind
if (m_bIsConnected)
{
@@ -213,7 +213,7 @@ bool cServer::InitServer(cIniFile & a_SettingsIni)
LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS);
LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS);
- if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever
+ if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever
{
LOGERROR("WSAStartup() != 0");
return false;
@@ -409,7 +409,7 @@ void cServer::TickClients(float a_Dt)
for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr)
{
delete *itr;
- } // for itr - RemoveClients[]
+ } // for itr - RemoveClients[]
}
diff --git a/src/Server.h b/src/Server.h
index a6b7297e8..b03359f03 100644
--- a/src/Server.h
+++ b/src/Server.h
@@ -133,7 +133,7 @@ public: // tolua_export
private:
- friend class cRoot; // so cRoot can create and destroy cServer
+ friend class cRoot; // so cRoot can create and destroy cServer
/** When NotifyClientWrite() is called, it is queued for this thread to process (to avoid deadlocks between cSocketThreads, cClientHandle and cChunkMap) */
class cNotifyWriteThread :
@@ -194,7 +194,7 @@ private:
int m_ClientViewDistance; // The default view distance for clients; settable in Settings.ini
- bool m_bIsConnected; // true - connected false - not connected
+ bool m_bIsConnected; // true - connected false - not connected
bool m_bRestarting;
@@ -244,7 +244,7 @@ private:
// cListenThread::cCallback overrides:
virtual void OnConnectionAccepted(cSocket & a_Socket) override;
-}; // tolua_export
+}; // tolua_export
diff --git a/src/Statistics.h b/src/Statistics.h
index 49750e8c0..d70a2aeab 100644
--- a/src/Statistics.h
+++ b/src/Statistics.h
@@ -118,7 +118,7 @@ private:
/* Signed (?) integral value. */
-typedef int StatValue; // tolua_export
+typedef int StatValue; // tolua_export
@@ -157,7 +157,7 @@ private:
// TODO 10-05-2014 xdot: Use, mine, craft statistics
-}; // tolua_export
+}; // tolua_export
diff --git a/src/Tracer.cpp b/src/Tracer.cpp
index be42430a5..d788d9e26 100644
--- a/src/Tracer.cpp
+++ b/src/Tracer.cpp
@@ -7,7 +7,7 @@
#include "Entities/Entity.h"
#ifndef _WIN32
- #include <stdlib.h> // abs()
+ #include <stdlib.h>
#endif
@@ -247,7 +247,7 @@ bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int
// return 1 = hit, other is not hit
int LinesCross(float x0,float y0,float x1,float y1,float x2,float y2,float x3,float y3)
{
- //float linx, liny;
+ // float linx, liny;
float d=(x1-x0)*(y3-y2)-(y1-y0)*(x3-x2);
if (abs(d)<0.001) {return 0;}
@@ -257,8 +257,8 @@ int LinesCross(float x0,float y0,float x1,float y1,float x2,float y2,float x3,fl
float CD=((y0-y2)*(x1-x0)-(x0-x2)*(y1-y0))/d;
if (CD>=0.0 && CD<=1.0)
{
- //linx=x0+AB*(x1-x0);
- //liny=y0+AB*(y1-y0);
+ // linx=x0+AB*(x1-x0);
+ // liny=y0+AB*(y1-y0);
return 1;
}
}
@@ -291,7 +291,7 @@ int cTracer::intersect3D_SegmentPlane( const Vector3f & a_Origin, const Vector3f
if (sI < 0 || sI > 1)
return 0; // no intersection
- //Vector3f I ( a_Ray->GetOrigin() + sI * u );//S.P0 + sI * u; // compute segment intersect point
+ // Vector3f I ( a_Ray->GetOrigin() + sI * u );//S.P0 + sI * u; // compute segment intersect point
RealHit = a_Origin + u * sI;
return 1;
}
@@ -310,8 +310,8 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
Vector3f Look = (end - start);
Look.Normalize();
- float dot = Look.Dot( Vector3f(-1, 0, 0) ); // first face normal is x -1
- if(dot < 0)
+ float dot = Look.Dot( Vector3f(-1, 0, 0) ); // first face normal is x -1
+ if (dot < 0)
{
int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x, BlockPos.y, BlockPos.x, BlockPos.y + 1 );
if(Lines == 1)
@@ -324,7 +324,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
}
}
}
- dot = Look.Dot( Vector3f(0, 0, -1) ); // second face normal is z -1
+ dot = Look.Dot( Vector3f(0, 0, -1) ); // second face normal is z -1
if(dot < 0)
{
int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z, BlockPos.y, BlockPos.z, BlockPos.y + 1 );
@@ -338,7 +338,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
}
}
}
- dot = Look.Dot( Vector3f(1, 0, 0) ); // third face normal is x 1
+ dot = Look.Dot( Vector3f(1, 0, 0) ); // third face normal is x 1
if(dot < 0)
{
int Lines = LinesCross( start.x, start.y, end.x, end.y, BlockPos.x + 1, BlockPos.y, BlockPos.x + 1, BlockPos.y + 1 );
@@ -352,7 +352,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
}
}
}
- dot = Look.Dot( Vector3f(0, 0, 1) ); // fourth face normal is z 1
+ dot = Look.Dot( Vector3f(0, 0, 1) ); // fourth face normal is z 1
if(dot < 0)
{
int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z + 1, BlockPos.y, BlockPos.z + 1, BlockPos.y + 1 );
@@ -366,7 +366,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
}
}
}
- dot = Look.Dot( Vector3f(0, 1, 0) ); // fifth face normal is y 1
+ dot = Look.Dot( Vector3f(0, 1, 0) ); // fifth face normal is y 1
if(dot < 0)
{
int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y + 1, BlockPos.x, BlockPos.y + 1, BlockPos.x + 1 );
@@ -380,7 +380,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
}
}
}
- dot = Look.Dot( Vector3f(0, -1, 0) ); // sixth face normal is y -1
+ dot = Look.Dot( Vector3f(0, -1, 0) ); // sixth face normal is y -1
if(dot < 0)
{
int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y, BlockPos.x, BlockPos.y, BlockPos.x + 1 );
diff --git a/src/Vector3.h b/src/Vector3.h
index c175bf135..1dcb38f64 100644
--- a/src/Vector3.h
+++ b/src/Vector3.h
@@ -3,7 +3,7 @@
-#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC)
+#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC)
#include <math.h>
#include <list>
#include <vector>
diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp
index d80849433..b3eab5659 100644
--- a/src/WebAdmin.cpp
+++ b/src/WebAdmin.cpp
@@ -391,7 +391,7 @@ AString cWebAdmin::GetDefaultPage(void)
Content += "<h4>Players:</h4><ul>";
cPlayerAccum PlayerAccum;
- cWorld * World = cRoot::Get()->GetDefaultWorld(); // TODO - Create a list of worlds and players
+ cWorld * World = cRoot::Get()->GetDefaultWorld(); // TODO - Create a list of worlds and players
if( World != NULL )
{
World->ForEachPlayer(PlayerAccum);
diff --git a/src/WebAdmin.h b/src/WebAdmin.h
index d5e45828f..d679a097c 100644
--- a/src/WebAdmin.h
+++ b/src/WebAdmin.h
@@ -60,11 +60,11 @@ struct HTTPRequest
StringStringMap Params; // >> EXPORTED IN MANUALBINDINGS <<
/** Parameters posted as a part of a form - either in the URL (GET method) or in the body (POST method) */
- StringStringMap PostParams; // >> EXPORTED IN MANUALBINDINGS <<
+ StringStringMap PostParams; // >> EXPORTED IN MANUALBINDINGS <<
/** Same as PostParams */
FormDataMap FormData; // >> EXPORTED IN MANUALBINDINGS <<
-} ; // tolua_export
+} ; // tolua_export
@@ -120,7 +120,7 @@ public:
void RemovePlugin(cWebPlugin * a_Plugin);
// TODO: Convert this to the auto-locking callback mechanism used for looping players in worlds and such
- PluginList GetPlugins() const { return m_Plugins; } // >> EXPORTED IN MANUALBINDINGS <<
+ PluginList GetPlugins() const { return m_Plugins; } // >> EXPORTED IN MANUALBINDINGS <<
// tolua_begin
@@ -218,7 +218,7 @@ protected:
virtual void OnRequestBegun (cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override;
virtual void OnRequestBody (cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, size_t a_Size) override;
virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override;
-} ; // tolua_export
+} ; // tolua_export
diff --git a/src/World.cpp b/src/World.cpp
index b3284942a..7f30f9b39 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -375,17 +375,15 @@ void cWorld::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ)
void cWorld::InitializeSpawn(void)
{
- if (!m_IsSpawnExplicitlySet) // Check if spawn position was already explicitly set or not
+ if (!m_IsSpawnExplicitlySet)
{
- GenerateRandomSpawn(); // Generate random solid-land coordinate and then write it to the world configuration
-
+ // Spawn position wasn't already explicitly set, enerate random solid-land coordinate and then write it to the world configuration:
+ GenerateRandomSpawn();
cIniFile IniFile;
IniFile.ReadFile(m_IniFileName);
-
IniFile.SetValueF("SpawnPosition", "X", m_SpawnX);
IniFile.SetValueF("SpawnPosition", "Y", m_SpawnY);
IniFile.SetValueF("SpawnPosition", "Z", m_SpawnZ);
-
IniFile.WriteFile(m_IniFileName);
}
@@ -648,7 +646,7 @@ void cWorld::GenerateRandomSpawn(void)
while (IsBlockWaterOrIce(GetBlock((int)m_SpawnX, GetHeight((int)m_SpawnX, (int)m_SpawnZ), (int)m_SpawnZ)))
{
- if ((GetTickRandomNumber(4) % 2) == 0) // Randomise whether to increment X or Z coords
+ if ((GetTickRandomNumber(4) % 2) == 0) // Randomise whether to increment X or Z coords
{
m_SpawnX += cChunkDef::Width;
}
@@ -658,7 +656,7 @@ void cWorld::GenerateRandomSpawn(void)
}
}
- m_SpawnY = (double)GetHeight((int)m_SpawnX, (int)m_SpawnZ) + 1.6f; // 1.6f to accomodate player height
+ m_SpawnY = (double)GetHeight((int)m_SpawnX, (int)m_SpawnZ) + 1.6f; // 1.6f to accomodate player height
LOGD("Generated random spawnpoint %i %i %i", (int)m_SpawnX, (int)m_SpawnY, (int)m_SpawnZ);
}
@@ -770,12 +768,12 @@ void cWorld::Tick(float a_Dt, int a_LastTickDurationMSec)
m_ChunkMap->FastSetQueuedBlocks();
- if (m_WorldAge - m_LastSave > 60 * 5 * 20) // Save each 5 minutes
+ if (m_WorldAge - m_LastSave > 60 * 5 * 20) // Save each 5 minutes
{
SaveAllChunks();
}
- if (m_WorldAge - m_LastUnload > 10 * 20) // Unload every 10 seconds
+ if (m_WorldAge - m_LastUnload > 10 * 20) // Unload every 10 seconds
{
UnloadUnusedChunks();
}
@@ -861,8 +859,8 @@ void cWorld::TickMobs(float a_Dt)
SpawnMobFinalize(*itr2);
}
}
- } // for i - AllFamilies[]
- } // if (Spawning enabled)
+ } // for i - AllFamilies[]
+ } // if (Spawning enabled)
// move close mobs
cMobProximityCounter::sIterablePair allCloseEnoughToMoveMobs = MobCensus.GetProximityCounter().getMobWithinThosesDistances(-1, 64 * 16);// MG TODO : deal with this magic number (the 16 is the size of a block)
@@ -972,7 +970,7 @@ void cWorld::TickClients(float a_Dt)
for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr)
{
delete *itr;
- } // for itr - RemoveClients[]
+ } // for itr - RemoveClients[]
}
@@ -3026,18 +3024,18 @@ void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Resul
cCSLock Lock(m_CSPlayers);
for (cPlayerList::iterator itr = m_Players.begin(), end = m_Players.end(); itr != end; ++itr)
{
- size_t LastSpace = a_Text.find_last_of(" "); // Find the position of the last space
+ size_t LastSpace = a_Text.find_last_of(" "); // Find the position of the last space
- AString LastWord = a_Text.substr(LastSpace + 1, a_Text.length()); // Find the last word
+ AString LastWord = a_Text.substr(LastSpace + 1, a_Text.length()); // Find the last word
AString PlayerName ((*itr)->GetName());
- size_t Found = PlayerName.find(LastWord); // Try to find last word in playername
+ size_t Found = PlayerName.find(LastWord); // Try to find last word in playername
if (Found == AString::npos)
{
- continue; // No match
+ continue; // No match
}
- a_Results.push_back(PlayerName); // Match!
+ a_Results.push_back(PlayerName); // Match!
}
}
diff --git a/src/World.h b/src/World.h
index a3b152a80..725e1eb71 100644
--- a/src/World.h
+++ b/src/World.h
@@ -218,14 +218,14 @@ public:
void BroadcastEntityStatus (const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude = NULL);
void BroadcastEntityVelocity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
virtual void BroadcastEntityAnimation(const cEntity & a_Entity, char a_Animation, const cClientHandle * a_Exclude = NULL) override;
- void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude = NULL); // tolua_export
+ void BroadcastParticleEffect (const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmmount, cClientHandle * a_Exclude = NULL); // tolua_export
void BroadcastPlayerListItem (const cPlayer & a_Player, bool a_IsOnline, const cClientHandle * a_Exclude = NULL);
void BroadcastRemoveEntityEffect (const cEntity & a_Entity, int a_EffectID, const cClientHandle * a_Exclude = NULL);
void BroadcastScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode);
void BroadcastScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode);
void BroadcastDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display);
void BroadcastSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude = NULL); // tolua_export
- void BroadcastSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL); // tolua_export
+ void BroadcastSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude = NULL); // tolua_export
void BroadcastSpawnEntity (cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
void BroadcastTeleportEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);
void BroadcastThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL);
@@ -859,7 +859,7 @@ private:
Int64 m_LastTimeUpdate; // The tick in which the last time update has been sent.
Int64 m_LastUnload; // The last WorldAge (in ticks) in which unloading was triggerred
Int64 m_LastSave; // The last WorldAge (in ticks) in which save-all was triggerred
- std::map<cMonster::eFamily,Int64> m_LastSpawnMonster; // The last WorldAge (in ticks) in which a monster was spawned (for each megatype of monster) // MG TODO : find a way to optimize without creating unmaintenability (if mob IDs are becoming unrowed)
+ std::map<cMonster::eFamily,Int64> m_LastSpawnMonster; // The last WorldAge (in ticks) in which a monster was spawned (for each megatype of monster) // MG TODO : find a way to optimize without creating unmaintenability (if mob IDs are becoming unrowed)
NIBBLETYPE m_SkyDarkness;
@@ -1011,7 +1011,7 @@ private:
/** Adds the players queued in the m_PlayersToAdd queue into the m_Players list.
Assumes it is called from the Tick thread. */
void AddQueuedPlayers(void);
-}; // tolua_export
+}; // tolua_export
diff --git a/src/main.cpp b/src/main.cpp
index c8ff31f07..f485d8f8f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,17 +3,17 @@
#include "Root.h"
-#include <exception> //std::exception
-#include <csignal> //std::signal
-#include <stdlib.h> //exit()
+#include <exception>
+#include <csignal>
+#include <stdlib.h>
#ifdef _MSC_VER
#include <dbghelp.h>
#endif // _MSC_VER
// Here, we have some ALL CAPS variables, to give the impression that this is deeeep, gritty programming :P
-bool g_TERMINATE_EVENT_RAISED = false; // If something has told the server to stop; checked periodically in cRoot
-bool g_SERVER_TERMINATED = false; // Set to true when the server terminates, so our CTRL handler can then tell Windows to close the console
+bool g_TERMINATE_EVENT_RAISED = false; // If something has told the server to stop; checked periodically in cRoot
+bool g_SERVER_TERMINATED = false; // Set to true when the server terminates, so our CTRL handler can then tell Windows to close the console
@@ -76,7 +76,7 @@ void NonCtrlHandler(int a_Signal)
case SIGINT:
case SIGTERM:
{
- std::signal(a_Signal, SIG_IGN); // Server is shutting down, wait for it...
+ std::signal(a_Signal, SIG_IGN); // Server is shutting down, wait for it...
break;
}
default: break;
@@ -158,9 +158,9 @@ BOOL CtrlHandler(DWORD fdwCtrlType)
g_TERMINATE_EVENT_RAISED = true;
LOGD("Terminate event raised from the Windows CtrlHandler");
- if (fdwCtrlType == CTRL_CLOSE_EVENT) // Console window closed via 'x' button, Windows will try to close immediately, therefore...
+ if (fdwCtrlType == CTRL_CLOSE_EVENT) // Console window closed via 'x' button, Windows will try to close immediately, therefore...
{
- while (!g_SERVER_TERMINATED) { cSleep::MilliSleep(100); } // Delay as much as possible to try to get the server to shut down cleanly
+ while (!g_SERVER_TERMINATED) { cSleep::MilliSleep(100); } // Delay as much as possible to try to get the server to shut down cleanly
}
return TRUE;
@@ -233,7 +233,7 @@ int main( int argc, char **argv )
std::signal(SIGABRT, NonCtrlHandler);
#ifdef SIGABRT_COMPAT
std::signal(SIGABRT_COMPAT, NonCtrlHandler);
- #endif // SIGABRT_COMPAT
+ #endif // SIGABRT_COMPAT
#endif
// DEBUG: test the dumpfile creation: