summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Bindings/ManualBindings.cpp22
-rw-r--r--src/Bindings/PluginManager.cpp2
-rw-r--r--src/Bindings/WebPlugin.cpp10
-rw-r--r--src/Blocks/BlockTorch.h7
-rw-r--r--src/Chunk.cpp5
-rw-r--r--src/CraftingRecipes.cpp2
-rw-r--r--src/Defines.h2
-rw-r--r--src/Entities/Player.cpp56
-rw-r--r--src/Globals.h2
-rw-r--r--src/GroupManager.cpp4
-rw-r--r--src/Inventory.cpp14
-rw-r--r--src/Items/ItemHandler.cpp2
-rw-r--r--src/Log.cpp8
-rw-r--r--src/MobProximityCounter.cpp4
-rw-r--r--src/MobSpawner.cpp2
-rw-r--r--src/Mobs/Monster.cpp2
-rw-r--r--src/OSSupport/Errors.cpp4
-rw-r--r--src/OSSupport/Semaphore.cpp12
-rw-r--r--src/OSSupport/Thread.cpp10
-rw-r--r--src/Protocol/Protocol17x.cpp2
-rw-r--r--src/Root.cpp6
-rw-r--r--src/Server.cpp2
-rw-r--r--src/Simulator/FireSimulator.cpp2
-rw-r--r--src/Simulator/FluidSimulator.cpp6
-rw-r--r--src/Tracer.cpp40
-rw-r--r--src/WebAdmin.cpp2
-rw-r--r--src/World.cpp6
-rw-r--r--src/WorldStorage/WSSCompact.cpp36
28 files changed, 137 insertions, 135 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index 4047adc3a..5e9e7349d 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -656,12 +656,12 @@ template<
static int tolua_ForEach(lua_State * tolua_S)
{
int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */
- if( NumArgs != 1 && NumArgs != 2)
+ if ((NumArgs != 1) && (NumArgs != 2))
{
return lua_do_error(tolua_S, "Error in function call '#funcname#': Requires 1 or 2 arguments, got %i", NumArgs);
}
- Ty1 * self = (Ty1 *) tolua_tousertype(tolua_S, 1, NULL);
+ Ty1 * self = (Ty1 *)tolua_tousertype(tolua_S, 1, NULL);
if (self == NULL)
{
return lua_do_error(tolua_S, "Error in function call '#funcname#': Not called on an object instance");
@@ -1360,7 +1360,7 @@ static int tolua_cPluginManager_AddHook(lua_State * tolua_S)
static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S)
{
int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */
- if( NumArgs != 1)
+ if (NumArgs != 1)
{
LOGWARN("Error in function call 'ForEachCommand': Requires 1 argument, got %i", NumArgs);
return 0;
@@ -1437,7 +1437,7 @@ static int tolua_cPluginManager_ForEachCommand(lua_State * tolua_S)
static int tolua_cPluginManager_ForEachConsoleCommand(lua_State * tolua_S)
{
int NumArgs = lua_gettop(tolua_S) - 1; /* This includes 'self' */
- if( NumArgs != 1)
+ if (NumArgs != 1)
{
LOGWARN("Error in function call 'ForEachConsoleCommand': Requires 1 argument, got %i", NumArgs);
return 0;
@@ -1938,16 +1938,16 @@ static int tolua_cPluginLua_AddWebTab(lua_State * tolua_S)
return tolua_do_error(tolua_S, "#ferror calling function '#funcname#'", &tolua_err);
}
- if( Reference != LUA_REFNIL )
+ if (Reference != LUA_REFNIL)
{
- if( !self->AddWebTab( Title.c_str(), tolua_S, Reference ) )
+ if (!self->AddWebTab(Title.c_str(), tolua_S, Reference))
{
- luaL_unref( tolua_S, LUA_REGISTRYINDEX, Reference );
+ luaL_unref(tolua_S, LUA_REGISTRYINDEX, Reference);
}
}
else
{
- LOGERROR("ERROR: cPluginLua:AddWebTab invalid function reference in 2nd argument (Title: \"%s\")", Title.c_str() );
+ LOGWARNING("cPluginLua:AddWebTab: invalid function reference in 2nd argument (Title: \"%s\")", Title.c_str());
}
return 0;
@@ -2016,7 +2016,7 @@ static int tolua_push_StringStringMap(lua_State* tolua_S, std::map< std::string,
lua_newtable(tolua_S);
int top = lua_gettop(tolua_S);
- for( std::map< std::string, std::string >::iterator it = a_StringStringMap.begin(); it != a_StringStringMap.end(); ++it )
+ for (std::map<std::string, std::string>::iterator it = a_StringStringMap.begin(); it != a_StringStringMap.end(); ++it)
{
const char* key = it->first.c_str();
const char* value = it->second.c_str();
@@ -2060,7 +2060,7 @@ static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S)
lua_newtable(tolua_S);
int top = lua_gettop(tolua_S);
- for( std::map< std::string, HTTPFormData >::iterator it = FormData.begin(); it != FormData.end(); ++it )
+ for (std::map<std::string, HTTPFormData>::iterator it = FormData.begin(); it != FormData.end(); ++it)
{
lua_pushstring(tolua_S, it->first.c_str() );
tolua_pushusertype(tolua_S, &(it->second), "HTTPFormData" );
@@ -2109,7 +2109,7 @@ static int tolua_cWebPlugin_GetTabNames(lua_State * tolua_S)
lua_newtable(tolua_S);
int index = 1;
cWebPlugin::TabNameList::const_iterator iter = TabNames.begin();
- while(iter != TabNames.end())
+ while (iter != TabNames.end())
{
const AString & FancyName = iter->first;
const AString & WebName = iter->second;
diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp
index 2c0ce701b..33ecb95ad 100644
--- a/src/Bindings/PluginManager.cpp
+++ b/src/Bindings/PluginManager.cpp
@@ -1434,7 +1434,7 @@ cPluginManager::CommandResult cPluginManager::HandleCommand(cPlayer * a_Player,
cPlugin * cPluginManager::GetPlugin( const AString & a_Plugin ) const
{
- for( PluginMap::const_iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr )
+ for (PluginMap::const_iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr)
{
if (itr->second == NULL ) continue;
if (itr->second->GetName().compare(a_Plugin) == 0)
diff --git a/src/Bindings/WebPlugin.cpp b/src/Bindings/WebPlugin.cpp
index 57ed9f6a4..a22826d1b 100644
--- a/src/Bindings/WebPlugin.cpp
+++ b/src/Bindings/WebPlugin.cpp
@@ -45,7 +45,7 @@ cWebPlugin::~cWebPlugin()
std::list<std::pair<AString, AString> > cWebPlugin::GetTabNames(void)
{
std::list< std::pair< AString, AString > > NameList;
- for( TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr )
+ for (TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr )
{
std::pair< AString, AString > StringPair;
StringPair.first = (*itr)->Title;
@@ -69,7 +69,7 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
sWebPluginTab * Tab = NULL;
if (Split.size() > 2) // If we got the tab name, show that page
{
- for( TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr )
+ for (TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr )
{
if ((*itr)->SafeTitle.compare(Split[2]) == 0) // This is the one!
{
@@ -80,7 +80,7 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
}
else // Otherwise show the first tab
{
- if( GetTabs().size() > 0 )
+ if (GetTabs().size() > 0 )
Tab = *GetTabs().begin();
}
@@ -100,10 +100,10 @@ std::pair< AString, AString > cWebPlugin::GetTabNameForRequest(const HTTPRequest
AString cWebPlugin::SafeString(const AString & a_String)
{
AString RetVal;
- for( unsigned int i = 0; i < a_String.size(); ++i )
+ for (unsigned int i = 0; i < a_String.size(); ++i )
{
char c = a_String[i];
- if( c == ' ' )
+ if (c == ' ' )
{
c = '_';
}
diff --git a/src/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h
index 73f2bf9a8..b62268187 100644
--- a/src/Blocks/BlockTorch.h
+++ b/src/Blocks/BlockTorch.h
@@ -99,7 +99,7 @@ public:
static bool CanBePlacedOn(BLOCKTYPE a_BlockType, eBlockFace a_BlockFace)
{
- if ( !cBlockInfo::FullyOccupiesVoxel(a_BlockType) )
+ if (!cBlockInfo::FullyOccupiesVoxel(a_BlockType) )
{
return (a_BlockFace == BLOCK_FACE_TOP); // Allow placement only when torch upright (for glass, etc.); exceptions won't even be sent by client, no need to handle
}
@@ -119,7 +119,8 @@ public:
AddFaceDirection(a_BlockX, a_BlockY, a_BlockZ, Face, true);
BLOCKTYPE BlockInQuestion = a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ);
- if ( // If on a block that can only hold a torch if torch is standing on it, return that face
+ // If on a block that can only hold a torch if torch is standing on it, return that face
+ if (
((BlockInQuestion == E_BLOCK_GLASS) ||
(BlockInQuestion == E_BLOCK_FENCE) ||
(BlockInQuestion == E_BLOCK_NETHER_BRICK_FENCE) ||
@@ -167,7 +168,7 @@ public:
// No need to check for upright orientation, it was done when the torch was placed
return true;
}
- else if ( !cBlockInfo::FullyOccupiesVoxel(BlockInQuestion) )
+ else if (!cBlockInfo::FullyOccupiesVoxel(BlockInQuestion) )
{
return false;
}
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 6e2d3509d..25a58458e 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -1530,11 +1530,12 @@ 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 ...
+ // Queue block to be sent only if ...
+ 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:
+ !( // ... the old and new blocktypes AREN'T liquids (because client doesn't need to distinguish betwixt them):
((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
diff --git a/src/CraftingRecipes.cpp b/src/CraftingRecipes.cpp
index e60c407d0..85a373279 100644
--- a/src/CraftingRecipes.cpp
+++ b/src/CraftingRecipes.cpp
@@ -582,7 +582,7 @@ cCraftingRecipes::cRecipe * cCraftingRecipes::FindRecipe(const cItem * a_Craftin
// Get the real bounds of the crafting grid:
int GridLeft = MAX_GRID_WIDTH, GridTop = MAX_GRID_HEIGHT;
int GridRight = 0, GridBottom = 0;
- for (int y = 0; y < a_GridHeight; y++ ) for(int x = 0; x < a_GridWidth; x++)
+ for (int y = 0; y < a_GridHeight; y++ ) for (int x = 0; x < a_GridWidth; x++)
{
if (!a_CraftingGrid[x + y * a_GridWidth].IsEmpty())
{
diff --git a/src/Defines.h b/src/Defines.h
index f7c8d0fc5..f4ebbd9ff 100644
--- a/src/Defines.h
+++ b/src/Defines.h
@@ -717,7 +717,7 @@ namespace ItemCategory
inline bool BlockRequiresSpecialTool(BLOCKTYPE a_BlockType)
{
- if(!IsValidBlock(a_BlockType)) return false;
+ if (!IsValidBlock(a_BlockType)) return false;
return cBlockInfo::RequiresSpecialTool(a_BlockType);
}
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 808b74023..6a52d8e29 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -286,13 +286,13 @@ void cPlayer::Tick(float a_Dt, cChunk & a_Chunk)
short cPlayer::CalcLevelFromXp(short a_XpTotal)
{
// level 0 to 15
- if(a_XpTotal <= XP_TO_LEVEL15)
+ if (a_XpTotal <= XP_TO_LEVEL15)
{
return a_XpTotal / XP_PER_LEVEL_TO15;
}
// level 30+
- if(a_XpTotal > XP_TO_LEVEL30)
+ if (a_XpTotal > XP_TO_LEVEL30)
{
return (short) (151.5 + sqrt( 22952.25 - (14 * (2220 - a_XpTotal)))) / 7;
}
@@ -308,13 +308,13 @@ short cPlayer::CalcLevelFromXp(short a_XpTotal)
short cPlayer::XpForLevel(short a_Level)
{
// level 0 to 15
- if(a_Level <= 15)
+ if (a_Level <= 15)
{
return a_Level * XP_PER_LEVEL_TO15;
}
// level 30+
- if(a_Level >= 31)
+ if (a_Level >= 31)
{
return (short) ( (3.5 * a_Level * a_Level) - (151.5 * a_Level) + 2220 );
}
@@ -351,7 +351,7 @@ float cPlayer::GetXpPercentage()
bool cPlayer::SetCurrentExperience(short int a_CurrentXp)
{
- if(!(a_CurrentXp >= 0) || (a_CurrentXp > (SHRT_MAX - m_LifetimeTotalXp)))
+ if (!(a_CurrentXp >= 0) || (a_CurrentXp > (SHRT_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
@@ -1370,9 +1370,9 @@ void cPlayer::AddToGroup( const AString & a_GroupName )
void cPlayer::RemoveFromGroup( const AString & a_GroupName )
{
bool bRemoved = false;
- for( GroupList::iterator itr = m_Groups.begin(); itr != m_Groups.end(); ++itr )
+ for (GroupList::iterator itr = m_Groups.begin(); itr != m_Groups.end(); ++itr )
{
- if( (*itr)->GetName().compare(a_GroupName ) == 0 )
+ if ((*itr)->GetName().compare(a_GroupName ) == 0 )
{
m_Groups.erase( itr );
bRemoved = true;
@@ -1380,7 +1380,7 @@ void cPlayer::RemoveFromGroup( const AString & a_GroupName )
}
}
- if( bRemoved )
+ if (bRemoved )
{
LOGD("Removed %s from group %s", GetName().c_str(), a_GroupName.c_str() );
ResolveGroups();
@@ -1407,24 +1407,24 @@ bool cPlayer::HasPermission(const AString & a_Permission)
AStringVector Split = StringSplit( a_Permission, "." );
PermissionMap Possibilities = m_ResolvedPermissions;
// Now search the namespaces
- while( Possibilities.begin() != Possibilities.end() )
+ while (Possibilities.begin() != Possibilities.end() )
{
PermissionMap::iterator itr = Possibilities.begin();
- if( itr->second )
+ if (itr->second )
{
AStringVector OtherSplit = StringSplit( itr->first, "." );
- if( OtherSplit.size() <= Split.size() )
+ if (OtherSplit.size() <= Split.size() )
{
unsigned int i;
- for( i = 0; i < OtherSplit.size(); ++i )
+ for (i = 0; i < OtherSplit.size(); ++i )
{
- if( OtherSplit[i].compare( Split[i] ) != 0 )
+ if (OtherSplit[i].compare( Split[i] ) != 0 )
{
- if( OtherSplit[i].compare("*") == 0 ) return true; // WildCard man!! WildCard!
+ if (OtherSplit[i].compare("*") == 0 ) return true; // WildCard man!! WildCard!
break;
}
}
- if( i == Split.size() ) return true;
+ if (i == Split.size() ) return true;
}
}
Possibilities.erase( itr );
@@ -1440,9 +1440,9 @@ bool cPlayer::HasPermission(const AString & a_Permission)
bool cPlayer::IsInGroup( const AString & a_Group )
{
- for( GroupList::iterator itr = m_ResolvedGroups.begin(); itr != m_ResolvedGroups.end(); ++itr )
+ for (GroupList::iterator itr = m_ResolvedGroups.begin(); itr != m_ResolvedGroups.end(); ++itr )
{
- if( a_Group.compare( (*itr)->GetName().c_str() ) == 0 )
+ if (a_Group.compare( (*itr)->GetName().c_str() ) == 0 )
return true;
}
return false;
@@ -1457,15 +1457,15 @@ void cPlayer::ResolvePermissions()
m_ResolvedPermissions.clear(); // Start with an empty map
// Copy all player specific permissions into the resolved permissions map
- for( PermissionMap::iterator itr = m_Permissions.begin(); itr != m_Permissions.end(); ++itr )
+ for (PermissionMap::iterator itr = m_Permissions.begin(); itr != m_Permissions.end(); ++itr )
{
m_ResolvedPermissions[ itr->first ] = itr->second;
}
- for( GroupList::iterator GroupItr = m_ResolvedGroups.begin(); GroupItr != m_ResolvedGroups.end(); ++GroupItr )
+ for (GroupList::iterator GroupItr = m_ResolvedGroups.begin(); GroupItr != m_ResolvedGroups.end(); ++GroupItr )
{
const cGroup::PermissionMap & Permissions = (*GroupItr)->GetPermissions();
- for( cGroup::PermissionMap::const_iterator itr = Permissions.begin(); itr != Permissions.end(); ++itr )
+ for (cGroup::PermissionMap::const_iterator itr = Permissions.begin(); itr != Permissions.end(); ++itr )
{
m_ResolvedPermissions[ itr->first ] = itr->second;
}
@@ -1484,14 +1484,14 @@ void cPlayer::ResolveGroups()
// Get a complete resolved list of all groups the player is in
std::map< cGroup*, bool > AllGroups; // Use a map, because it's faster than iterating through a list to find duplicates
GroupList ToIterate;
- for( GroupList::iterator GroupItr = m_Groups.begin(); GroupItr != m_Groups.end(); ++GroupItr )
+ for (GroupList::iterator GroupItr = m_Groups.begin(); GroupItr != m_Groups.end(); ++GroupItr )
{
ToIterate.push_back( *GroupItr );
}
- while( ToIterate.begin() != ToIterate.end() )
+ while (ToIterate.begin() != ToIterate.end() )
{
cGroup* CurrentGroup = *ToIterate.begin();
- if( AllGroups.find( CurrentGroup ) != AllGroups.end() )
+ if (AllGroups.find( CurrentGroup ) != AllGroups.end() )
{
LOGWARNING("ERROR: Player \"%s\" is in the group multiple times (\"%s\"). Please fix your settings in users.ini!",
GetName().c_str(), CurrentGroup->GetName().c_str()
@@ -1502,9 +1502,9 @@ void cPlayer::ResolveGroups()
AllGroups[ CurrentGroup ] = true;
m_ResolvedGroups.push_back( CurrentGroup ); // Add group to resolved list
const cGroup::GroupList & Inherits = CurrentGroup->GetInherits();
- for( cGroup::GroupList::const_iterator itr = Inherits.begin(); itr != Inherits.end(); ++itr )
+ for (cGroup::GroupList::const_iterator itr = Inherits.begin(); itr != Inherits.end(); ++itr )
{
- if( AllGroups.find( *itr ) != AllGroups.end() )
+ if (AllGroups.find( *itr ) != AllGroups.end() )
{
LOGERROR("ERROR: Player %s is in the same group multiple times due to inheritance (%s). FIX IT!", GetName().c_str(), (*itr)->GetName().c_str() );
continue;
@@ -1522,12 +1522,12 @@ void cPlayer::ResolveGroups()
AString cPlayer::GetColor(void) const
{
- if ( m_Color != '-' )
+ if (m_Color != '-' )
{
return cChatColor::Delimiter + m_Color;
}
- if ( m_Groups.size() < 1 )
+ if (m_Groups.size() < 1 )
{
return cChatColor::White;
}
@@ -1914,7 +1914,7 @@ cPlayer::StringList cPlayer::GetResolvedPermissions()
StringList Permissions;
const PermissionMap& ResolvedPermissions = m_ResolvedPermissions;
- for( PermissionMap::const_iterator itr = ResolvedPermissions.begin(); itr != ResolvedPermissions.end(); ++itr )
+ for (PermissionMap::const_iterator itr = ResolvedPermissions.begin(); itr != ResolvedPermissions.end(); ++itr )
{
if (itr->second)
{
diff --git a/src/Globals.h b/src/Globals.h
index 932040ec2..007fa10d0 100644
--- a/src/Globals.h
+++ b/src/Globals.h
@@ -309,7 +309,7 @@ void inline LOGERROR(const char* a_Format, ...)
}
#endif
#define ASSERT(x) do { if (!(x)) { throw cAssertFailure();} } while (0)
- #define testassert(x) do { if(!(x)) { REPORT_ERROR("Test failure: %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } } while (0)
+ #define testassert(x) do { if (!(x)) { REPORT_ERROR("Test failure: %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } } while (0)
#define CheckAsserts(x) do { try {x} catch (cAssertFailure) { break; } REPORT_ERROR("Test failure: assert didn't fire for %s, file %s, line %d\n", #x, __FILE__, __LINE__); exit(1); } while (0)
#else
diff --git a/src/GroupManager.cpp b/src/GroupManager.cpp
index a1cc396cf..685aece5a 100644
--- a/src/GroupManager.cpp
+++ b/src/GroupManager.cpp
@@ -27,7 +27,7 @@ struct cGroupManager::sGroupManagerState
cGroupManager::~cGroupManager()
{
- for( GroupMap::iterator itr = m_pState->Groups.begin(); itr != m_pState->Groups.end(); ++itr )
+ for (GroupMap::iterator itr = m_pState->Groups.begin(); itr != m_pState->Groups.end(); ++itr )
{
delete itr->second;
itr->second = NULL;
@@ -211,7 +211,7 @@ bool cGroupManager::ExistsGroup( const AString & a_Name )
cGroup* cGroupManager::GetGroup( const AString & a_Name )
{
GroupMap::iterator itr = m_pState->Groups.find( a_Name );
- if( itr != m_pState->Groups.end() )
+ if (itr != m_pState->Groups.end() )
{
return itr->second;
}
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index 5f7c24b60..93b2c8eee 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -500,15 +500,15 @@ int cInventory::ArmorSlotNumToEntityEquipmentID(short a_ArmorSlotNum)
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 )
+ if (a_Mode < 2 )
{
int MaxStackSize = cItemHandler::GetItemHandler(a_Item.m_ItemType)->GetMaxStackSize();
- for(int i = 0; i < a_Size; i++)
+ for (int i = 0; i < a_Size; i++)
{
- if( m_Slots[i + a_Offset].m_ItemType == a_Item.m_ItemType && m_Slots[i + a_Offset].m_ItemCount < MaxStackSize && m_Slots[i + a_Offset].m_ItemDamage == a_Item.m_ItemDamage )
+ if (m_Slots[i + a_Offset].m_ItemType == a_Item.m_ItemType && m_Slots[i + a_Offset].m_ItemCount < MaxStackSize && m_Slots[i + a_Offset].m_ItemDamage == a_Item.m_ItemDamage )
{
int NumFree = MaxStackSize - m_Slots[i + a_Offset].m_ItemCount;
- if( NumFree >= a_Item.m_ItemCount )
+ if (NumFree >= a_Item.m_ItemCount )
{
// printf("1. Adding %i items ( free: %i )\n", a_Item.m_ItemCount, NumFree );
@@ -528,12 +528,12 @@ bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size,
}
}
- if( a_Mode > 0 )
+ if (a_Mode > 0 )
{
// If we got more left, find first empty slot
- for(int i = 0; i < a_Size && a_Item.m_ItemCount > 0; i++)
+ for (int i = 0; i < a_Size && a_Item.m_ItemCount > 0; i++)
{
- if( m_Slots[i + a_Offset].m_ItemType == -1 )
+ if (m_Slots[i + a_Offset].m_ItemType == -1 )
{
m_Slots[i + a_Offset] = a_Item;
a_Item.m_ItemCount = 0;
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index 178bc2fca..0a8638f3a 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -263,7 +263,7 @@ cItemHandler *cItemHandler::CreateItemHandler(int a_ItemType)
void cItemHandler::Deinit()
{
- for(int i = 0; i < 2267; i++)
+ for (int i = 0; i < 2267; i++)
{
delete m_ItemHandler[i];
m_ItemHandler[i] = NULL;
diff --git a/src/Log.cpp b/src/Log.cpp
index 69b9c13a2..a70b09103 100644
--- a/src/Log.cpp
+++ b/src/Log.cpp
@@ -59,7 +59,7 @@ cLog * cLog::GetInstance()
void cLog::CloseLog()
{
- if( m_File )
+ if (m_File )
fclose (m_File);
m_File = 0;
}
@@ -70,7 +70,7 @@ void cLog::CloseLog()
void cLog::OpenLog( const char* a_FileName )
{
- if(m_File) fclose (m_File);
+ if (m_File) fclose (m_File);
#ifdef _MSC_VER
fopen_s( &m_File, a_FileName, "a+" );
#else
@@ -85,11 +85,11 @@ void cLog::OpenLog( const char* a_FileName )
void cLog::ClearLog()
{
#ifdef _MSC_VER
- if( fopen_s( &m_File, "log.txt", "w" ) == 0)
+ if (fopen_s( &m_File, "log.txt", "w" ) == 0)
fclose (m_File);
#else
m_File = fopen("log.txt", "w" );
- if( m_File )
+ if (m_File )
fclose (m_File);
#endif
m_File = NULL;
diff --git a/src/MobProximityCounter.cpp b/src/MobProximityCounter.cpp
index f5d3e970c..82ba771ff 100644
--- a/src/MobProximityCounter.cpp
+++ b/src/MobProximityCounter.cpp
@@ -34,7 +34,7 @@ void cMobProximityCounter::CollectMob(cEntity& a_Monster, cChunk& a_Chunk, doubl
void cMobProximityCounter::convertMaps()
{
- for(tMonsterToDistance::const_iterator itr = m_MonsterToDistance.begin(); itr != m_MonsterToDistance.end(); ++itr)
+ for (tMonsterToDistance::const_iterator itr = m_MonsterToDistance.begin(); itr != m_MonsterToDistance.end(); ++itr)
{
m_DistanceToMonster.insert(tDistanceToMonster::value_type(itr->second.m_Distance, sMonsterAndChunk(*itr->first, *itr->second.m_Chunk)));
}
@@ -55,7 +55,7 @@ cMobProximityCounter::sIterablePair cMobProximityCounter::getMobWithinThosesDist
convertMaps();
}
- for(tDistanceToMonster::const_iterator itr = m_DistanceToMonster.begin(); itr != m_DistanceToMonster.end(); ++itr)
+ for (tDistanceToMonster::const_iterator itr = m_DistanceToMonster.begin(); itr != m_DistanceToMonster.end(); ++itr)
{
if (toReturn.m_Begin == m_DistanceToMonster.end())
{
diff --git a/src/MobSpawner.cpp b/src/MobSpawner.cpp
index ce1187452..53c83f166 100644
--- a/src/MobSpawner.cpp
+++ b/src/MobSpawner.cpp
@@ -208,7 +208,7 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_R
bool HasFloor = false;
for (int x = 0; x < 2; ++x)
{
- for(int z = 0; z < 2; ++z)
+ for (int z = 0; z < 2; ++z)
{
CanSpawn = a_Chunk->UnboundedRelGetBlockType(a_RelX + x, a_RelY, a_RelZ + z, TargetBlock);
CanSpawn = CanSpawn && (TargetBlock == E_BLOCK_AIR);
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 753a44914..c1247c1f8 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -281,7 +281,7 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
}
Vector3f Distance = m_Destination - GetPosition();
- if(!ReachedDestination() && !ReachedFinalDestination()) // If we haven't reached any sort of destination, move
+ if (!ReachedDestination() && !ReachedFinalDestination()) // If we haven't reached any sort of destination, move
{
Distance.y = 0;
Distance.Normalize();
diff --git a/src/OSSupport/Errors.cpp b/src/OSSupport/Errors.cpp
index 6072b6ac6..02de28e4e 100644
--- a/src/OSSupport/Errors.cpp
+++ b/src/OSSupport/Errors.cpp
@@ -25,7 +25,7 @@ AString GetOSErrorString( int a_ErrNo )
#if !defined(__APPLE__) && ( _GNU_SOURCE ) && !defined(ANDROID_NDK) // GNU version of strerror_r()
char * res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) );
- if( res != NULL )
+ if (res != NULL )
{
Printf(Out, "%d: %s", a_ErrNo, res);
return Out;
@@ -34,7 +34,7 @@ AString GetOSErrorString( int a_ErrNo )
#else // XSI version of strerror_r():
int res = strerror_r( errno, buffer, ARRAYCOUNT(buffer) );
- if( res == 0 )
+ if (res == 0 )
{
Printf(Out, "%d: %s", a_ErrNo, buffer);
return Out;
diff --git a/src/OSSupport/Semaphore.cpp b/src/OSSupport/Semaphore.cpp
index d919c4744..cb9ccc83b 100644
--- a/src/OSSupport/Semaphore.cpp
+++ b/src/OSSupport/Semaphore.cpp
@@ -22,13 +22,13 @@ cSemaphore::cSemaphore( unsigned int a_MaxCount, unsigned int a_InitialCount /*
AString Name;
Printf(Name, "cSemaphore%p", this );
m_Handle = sem_open(Name.c_str(), O_CREAT, 777, a_InitialCount);
- if( m_Handle == SEM_FAILED )
+ if (m_Handle == SEM_FAILED )
{
LOG("ERROR: Could not create Semaphore. (%i)", errno );
}
else
{
- if( sem_unlink(Name.c_str()) != 0 )
+ if (sem_unlink(Name.c_str()) != 0 )
{
LOG("ERROR: Could not unlink cSemaphore. (%i)", errno);
}
@@ -53,9 +53,9 @@ cSemaphore::~cSemaphore()
#ifdef _WIN32
CloseHandle( m_Handle );
#else
- if( m_bNamed )
+ if (m_bNamed )
{
- if( sem_close( (sem_t*)m_Handle ) != 0 )
+ if (sem_close( (sem_t*)m_Handle ) != 0 )
{
LOG("ERROR: Could not close cSemaphore. (%i)", errno);
}
@@ -77,7 +77,7 @@ cSemaphore::~cSemaphore()
void cSemaphore::Wait()
{
#ifndef _WIN32
- if( sem_wait( (sem_t*)m_Handle ) != 0)
+ if (sem_wait( (sem_t*)m_Handle ) != 0)
{
LOG("ERROR: Could not wait for cSemaphore. (%i)", errno);
}
@@ -93,7 +93,7 @@ void cSemaphore::Wait()
void cSemaphore::Signal()
{
#ifndef _WIN32
- if( sem_post( (sem_t*)m_Handle ) != 0 )
+ if (sem_post( (sem_t*)m_Handle ) != 0 )
{
LOG("ERROR: Could not signal cSemaphore. (%i)", errno);
}
diff --git a/src/OSSupport/Thread.cpp b/src/OSSupport/Thread.cpp
index 163c9b0c9..811e7cb21 100644
--- a/src/OSSupport/Thread.cpp
+++ b/src/OSSupport/Thread.cpp
@@ -53,7 +53,7 @@ cThread::cThread( ThreadFunc a_ThreadFunction, void* a_Param, const char* a_Thre
, m_Event( new cEvent() )
, m_StopEvent( 0 )
{
- if( a_ThreadName )
+ if (a_ThreadName )
{
m_ThreadName.assign(a_ThreadName);
}
@@ -68,7 +68,7 @@ cThread::~cThread()
delete m_Event;
m_Event = NULL;
- if( m_StopEvent )
+ if (m_StopEvent )
{
m_StopEvent->Wait();
delete m_StopEvent;
@@ -82,12 +82,12 @@ cThread::~cThread()
void cThread::Start( bool a_bWaitOnDelete /* = true */ )
{
- if( a_bWaitOnDelete )
+ if (a_bWaitOnDelete )
m_StopEvent = new cEvent();
#ifndef _WIN32
pthread_t SndThread;
- if( pthread_create( &SndThread, NULL, MyThread, this) )
+ if (pthread_create( &SndThread, NULL, MyThread, this) )
LOGERROR("ERROR: Could not create thread!");
#else
DWORD ThreadID = 0;
@@ -132,6 +132,6 @@ void *cThread::MyThread( void *a_Param )
ThreadFunction( ThreadParam );
- if( StopEvent ) StopEvent->Set();
+ if (StopEvent ) StopEvent->Set();
return 0;
}
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp
index 2707fbf9f..dadf82716 100644
--- a/src/Protocol/Protocol17x.cpp
+++ b/src/Protocol/Protocol17x.cpp
@@ -1587,7 +1587,7 @@ void cProtocol172::AddReceivedData(const char * a_Data, size_t a_Size)
ASSERT(!"Read wrong number of bytes!");
m_Client->PacketError(PacketType);
}
- } // for(ever)
+ } // for (ever)
// Log any leftover bytes into the logfile:
if (g_ShouldLogCommIn && (m_ReceivedData.GetReadableSpace() > 0))
diff --git a/src/Root.cpp b/src/Root.cpp
index ba25b97eb..e195b59ff 100644
--- a/src/Root.cpp
+++ b/src/Root.cpp
@@ -359,7 +359,7 @@ void cRoot::StopWorlds(void)
void cRoot::UnloadWorlds(void)
{
m_pDefaultWorld = NULL;
- for( WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr )
+ for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr )
{
delete itr->second;
}
@@ -382,7 +382,7 @@ cWorld* cRoot::GetDefaultWorld()
cWorld* cRoot::GetWorld( const AString & a_WorldName )
{
WorldMap::iterator itr = m_WorldsByName.find( a_WorldName );
- if( itr != m_WorldsByName.end() )
+ if (itr != m_WorldsByName.end() )
return itr->second;
return 0;
}
@@ -509,7 +509,7 @@ void cRoot::AuthenticateUser(int a_ClientID, const AString & a_Name, const AStri
int cRoot::GetTotalChunkCount(void)
{
int res = 0;
- for ( WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr )
+ for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr )
{
res += itr->second->GetNumChunks();
}
diff --git a/src/Server.cpp b/src/Server.cpp
index 180ec2ca6..0990fc398 100644
--- a/src/Server.cpp
+++ b/src/Server.cpp
@@ -631,7 +631,7 @@ void cServer::Shutdown(void)
cRoot::Get()->SaveAllChunks();
cCSLock Lock(m_CSClients);
- for( ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr )
+ for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr )
{
(*itr)->Destroy();
delete *itr;
diff --git a/src/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp
index 2164b6b10..69dc7164e 100644
--- a/src/Simulator/FireSimulator.cpp
+++ b/src/Simulator/FireSimulator.cpp
@@ -140,7 +140,7 @@ void cFireSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChun
continue;
}
- if((itr->y > 0) && (!DoesBurnForever(a_Chunk->GetBlock(itr->x, itr->y - 1, itr->z))))
+ if ((itr->y > 0) && (!DoesBurnForever(a_Chunk->GetBlock(itr->x, itr->y - 1, itr->z))))
{
a_Chunk->SetMeta(x, y, z, BlockMeta + 1);
}
diff --git a/src/Simulator/FluidSimulator.cpp b/src/Simulator/FluidSimulator.cpp
index 499e204a1..58501326f 100644
--- a/src/Simulator/FluidSimulator.cpp
+++ b/src/Simulator/FluidSimulator.cpp
@@ -159,18 +159,18 @@ Direction cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a
{
Vector3i *Pos = (*it);
char BlockID = m_World.GetBlock(Pos->x, Pos->y, Pos->z);
- if(IsAllowedBlock(BlockID))
+ if (IsAllowedBlock(BlockID))
{
char Meta = m_World.GetBlockMeta(Pos->x, Pos->y, Pos->z);
- if(Meta > LowestPoint)
+ if (Meta > LowestPoint)
{
LowestPoint = Meta;
X = Pos->x;
Z = Pos->z;
}
}
- else if(BlockID == E_BLOCK_AIR)
+ else if (BlockID == E_BLOCK_AIR)
{
LowestPoint = 9; // This always dominates
X = Pos->x;
diff --git a/src/Tracer.cpp b/src/Tracer.cpp
index fd8a297c0..df01e9129 100644
--- a/src/Tracer.cpp
+++ b/src/Tracer.cpp
@@ -59,7 +59,7 @@ void cTracer::SetValues(const Vector3f & a_Start, const Vector3f & a_Direction)
step.z = (int) SigNum(dir.z);
// normalize the direction vector
- if( dir.SqrLength() > 0.f ) dir.Normalize();
+ if (dir.SqrLength() > 0.f ) dir.Normalize();
// how far we must move in the ray direction before
// we encounter a new voxel in x-direction
@@ -192,7 +192,7 @@ bool cTracer::Trace( const Vector3f & a_Start, const Vector3f & a_Direction, int
if (step.y > 0.0f)
{
- if(pos.y >= end1.y)
+ if (pos.y >= end1.y)
{
reachedY = true;
}
@@ -313,7 +313,7 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
Vector3i SmallBlockPos = a_BlockPos;
char BlockID = m_World->GetBlock( a_BlockPos.x, a_BlockPos.y, a_BlockPos.z );
- if( BlockID == E_BLOCK_AIR || IsBlockWater(BlockID))
+ if (BlockID == E_BLOCK_AIR || IsBlockWater(BlockID))
{
return 0;
}
@@ -328,10 +328,10 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
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)
+ if (Lines == 1)
{
Lines = LinesCross( start.x, start.z, end.x, end.z, BlockPos.x, BlockPos.z, BlockPos.x, BlockPos.z + 1 );
- if(Lines == 1)
+ if (Lines == 1)
{
intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(-1, 0, 0) );
return 1;
@@ -339,13 +339,13 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
}
}
dot = Look.Dot( Vector3f(0, 0, -1) ); // second face normal is z -1
- if(dot < 0)
+ if (dot < 0)
{
int Lines = LinesCross( start.z, start.y, end.z, end.y, BlockPos.z, BlockPos.y, BlockPos.z, BlockPos.y + 1 );
- if(Lines == 1)
+ if (Lines == 1)
{
Lines = LinesCross( start.z, start.x, end.z, end.x, BlockPos.z, BlockPos.x, BlockPos.z, BlockPos.x + 1 );
- if(Lines == 1)
+ if (Lines == 1)
{
intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(0, 0, -1) );
return 2;
@@ -353,13 +353,13 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
}
}
dot = Look.Dot( Vector3f(1, 0, 0) ); // third face normal is x 1
- if(dot < 0)
+ 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 );
- if(Lines == 1)
+ if (Lines == 1)
{
Lines = LinesCross( start.x, start.z, end.x, end.z, BlockPos.x + 1, BlockPos.z, BlockPos.x + 1, BlockPos.z + 1 );
- if(Lines == 1)
+ if (Lines == 1)
{
intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(1, 0, 0), Vector3f(1, 0, 0) );
return 3;
@@ -367,13 +367,13 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
}
}
dot = Look.Dot( Vector3f(0, 0, 1) ); // fourth face normal is z 1
- if(dot < 0)
+ 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 );
- if(Lines == 1)
+ if (Lines == 1)
{
Lines = LinesCross( start.z, start.x, end.z, end.x, BlockPos.z + 1, BlockPos.x, BlockPos.z + 1, BlockPos.x + 1 );
- if(Lines == 1)
+ if (Lines == 1)
{
intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(0, 0, 1), Vector3f(0, 0, 1) );
return 4;
@@ -381,13 +381,13 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
}
}
dot = Look.Dot( Vector3f(0, 1, 0) ); // fifth face normal is y 1
- if(dot < 0)
+ 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 );
- if(Lines == 1)
+ if (Lines == 1)
{
Lines = LinesCross( start.y, start.z, end.y, end.z, BlockPos.y + 1, BlockPos.z, BlockPos.y + 1, BlockPos.z + 1 );
- if(Lines == 1)
+ if (Lines == 1)
{
intersect3D_SegmentPlane( start, end, BlockPos + Vector3f(0, 1, 0), Vector3f(0, 1, 0) );
return 5;
@@ -395,13 +395,13 @@ int cTracer::GetHitNormal(const Vector3f & start, const Vector3f & end, const Ve
}
}
dot = Look.Dot( Vector3f(0, -1, 0) ); // sixth face normal is y -1
- if(dot < 0)
+ if (dot < 0)
{
int Lines = LinesCross( start.y, start.x, end.y, end.x, BlockPos.y, BlockPos.x, BlockPos.y, BlockPos.x + 1 );
- if(Lines == 1)
+ if (Lines == 1)
{
Lines = LinesCross( start.y, start.z, end.y, end.z, BlockPos.y, BlockPos.z, BlockPos.y, BlockPos.z + 1 );
- if(Lines == 1)
+ if (Lines == 1)
{
intersect3D_SegmentPlane( start, end, BlockPos, Vector3f(0, -1, 0) );
return 6;
diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp
index be72f2d5a..d8347e2b9 100644
--- a/src/WebAdmin.cpp
+++ b/src/WebAdmin.cpp
@@ -392,7 +392,7 @@ AString cWebAdmin::GetDefaultPage(void)
cPlayerAccum PlayerAccum;
cWorld * World = cRoot::Get()->GetDefaultWorld(); // TODO - Create a list of worlds and players
- if( World != NULL )
+ if (World != NULL )
{
World->ForEachPlayer(PlayerAccum);
Content.append(PlayerAccum.m_Contents);
diff --git a/src/World.cpp b/src/World.cpp
index d90383884..c146338d7 100644
--- a/src/World.cpp
+++ b/src/World.cpp
@@ -865,14 +865,14 @@ void cWorld::TickMobs(float a_Dt)
// 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)
- for(cMobProximityCounter::tDistanceToMonster::const_iterator itr = allCloseEnoughToMoveMobs.m_Begin; itr != allCloseEnoughToMoveMobs.m_End; ++itr)
+ for (cMobProximityCounter::tDistanceToMonster::const_iterator itr = allCloseEnoughToMoveMobs.m_Begin; itr != allCloseEnoughToMoveMobs.m_End; ++itr)
{
itr->second.m_Monster.Tick(a_Dt, itr->second.m_Chunk);
}
// remove too far mobs
cMobProximityCounter::sIterablePair allTooFarMobs = MobCensus.GetProximityCounter().getMobWithinThosesDistances(128 * 16, -1);// MG TODO : deal with this magic number (the 16 is the size of a block)
- for(cMobProximityCounter::tDistanceToMonster::const_iterator itr = allTooFarMobs.m_Begin; itr != allTooFarMobs.m_End; ++itr)
+ for (cMobProximityCounter::tDistanceToMonster::const_iterator itr = allTooFarMobs.m_Begin; itr != allTooFarMobs.m_End; ++itr)
{
itr->second.m_Monster.Destroy(true);
}
@@ -2469,7 +2469,7 @@ cPlayer * cWorld::FindClosestPlayer(const Vector3d & a_Pos, float a_SightLimit,
{
if (a_CheckLineOfSight)
{
- if(!LineOfSight.Trace(a_Pos, (Pos - a_Pos), (int)(Pos - a_Pos).Length()))
+ if (!LineOfSight.Trace(a_Pos, (Pos - a_Pos), (int)(Pos - a_Pos).Length()))
{
ClosestDistance = Distance;
ClosestPlayer = *itr;
diff --git a/src/WorldStorage/WSSCompact.cpp b/src/WorldStorage/WSSCompact.cpp
index ff43b6905..aae94141c 100644
--- a/src/WorldStorage/WSSCompact.cpp
+++ b/src/WorldStorage/WSSCompact.cpp
@@ -486,12 +486,12 @@ cWSSCompact::cPAKFile::cPAKFile(const AString & a_FileName, int a_LayerX, int a_
return;
}
- if( m_ChunkVersion == 1 ) // Convert chunks to version 2
+ if (m_ChunkVersion == 1 ) // Convert chunks to version 2
{
UpdateChunk1To2();
}
#if AXIS_ORDER == AXIS_ORDER_XZY
- if( m_ChunkVersion == 2 ) // Convert chunks to version 3
+ if (m_ChunkVersion == 2 ) // Convert chunks to version 3
{
UpdateChunk2To3();
}
@@ -574,7 +574,7 @@ void cWSSCompact::cPAKFile::UpdateChunk1To2()
{
sChunkHeader * Header = *itr;
- if( ChunksConverted % 32 == 0 )
+ if (ChunksConverted % 32 == 0 )
{
LOGINFO("Updating \"%s\" version 1 to version 2: " SIZE_T_FMT " %%", m_FileName.c_str(), (ChunksConverted * 100) / m_ChunkHeaders.size() );
}
@@ -627,9 +627,9 @@ void cWSSCompact::cPAKFile::UpdateChunk1To2()
char ConvertedData[cChunkDef::BlockDataSize];
int Index = 0;
unsigned int InChunkOffset = 0;
- for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z )
+ for (int x = 0; x < 16; ++x ) for (int z = 0; z < 16; ++z )
{
- for( int y = 0; y < 128; ++y )
+ for (int y = 0; y < 128; ++y )
{
ConvertedData[Index++] = UncompressedData[y + z * 128 + x * 128 * 16 + InChunkOffset];
}
@@ -638,9 +638,9 @@ void cWSSCompact::cPAKFile::UpdateChunk1To2()
Index += 128;
}
InChunkOffset += (16 * 128 * 16);
- for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) // Metadata
+ for (int x = 0; x < 16; ++x ) for (int z = 0; z < 16; ++z ) // Metadata
{
- for( int y = 0; y < 64; ++y )
+ for (int y = 0; y < 64; ++y )
{
ConvertedData[Index++] = UncompressedData[y + z * 64 + x * 64 * 16 + InChunkOffset];
}
@@ -648,9 +648,9 @@ void cWSSCompact::cPAKFile::UpdateChunk1To2()
Index += 64;
}
InChunkOffset += (16 * 128 * 16) / 2;
- for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) // Block light
+ for (int x = 0; x < 16; ++x ) for (int z = 0; z < 16; ++z ) // Block light
{
- for( int y = 0; y < 64; ++y )
+ for (int y = 0; y < 64; ++y )
{
ConvertedData[Index++] = UncompressedData[y + z * 64 + x * 64 * 16 + InChunkOffset];
}
@@ -658,9 +658,9 @@ void cWSSCompact::cPAKFile::UpdateChunk1To2()
Index += 64;
}
InChunkOffset += (16*128*16)/2;
- for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) // Sky light
+ for (int x = 0; x < 16; ++x ) for (int z = 0; z < 16; ++z ) // Sky light
{
- for( int y = 0; y < 64; ++y )
+ for (int y = 0; y < 64; ++y )
{
ConvertedData[Index++] = UncompressedData[y + z * 64 + x * 64 * 16 + InChunkOffset];
}
@@ -718,7 +718,7 @@ void cWSSCompact::cPAKFile::UpdateChunk2To3()
{
sChunkHeader * Header = *itr;
- if( ChunksConverted % 32 == 0 )
+ if (ChunksConverted % 32 == 0 )
{
LOGINFO("Updating \"%s\" version 2 to version 3: " SIZE_T_FMT " %%", m_FileName.c_str(), (ChunksConverted * 100) / m_ChunkHeaders.size() );
}
@@ -774,7 +774,7 @@ void cWSSCompact::cPAKFile::UpdateChunk2To3()
#define MAKE_3_INDEX( x, y, z ) ( x + (z * 16) + (y * 16 * 16) )
unsigned int InChunkOffset = 0;
- for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y ) // YZX Loop order is important, in 1.1 Y was first then Z then X
+ for (int x = 0; x < 16; ++x ) for (int z = 0; z < 16; ++z ) for (int y = 0; y < 256; ++y ) // YZX Loop order is important, in 1.1 Y was first then Z then X
{
ConvertedData[ MAKE_3_INDEX(x, y, z) ] = UncompressedData[InChunkOffset];
++InChunkOffset;
@@ -782,7 +782,7 @@ void cWSSCompact::cPAKFile::UpdateChunk2To3()
unsigned int index2 = 0;
- for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y )
+ for (int x = 0; x < 16; ++x ) for (int z = 0; z < 16; ++z ) for (int y = 0; y < 256; ++y )
{
ConvertedData[ InChunkOffset + MAKE_3_INDEX(x, y, z)/2 ] |= ( (UncompressedData[ InChunkOffset + index2/2 ] >> ((index2&1)*4) ) & 0x0f ) << ((x&1)*4);
++index2;
@@ -790,7 +790,7 @@ void cWSSCompact::cPAKFile::UpdateChunk2To3()
InChunkOffset += index2 / 2;
index2 = 0;
- for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y )
+ for (int x = 0; x < 16; ++x ) for (int z = 0; z < 16; ++z ) for (int y = 0; y < 256; ++y )
{
ConvertedData[ InChunkOffset + MAKE_3_INDEX(x, y, z)/2 ] |= ( (UncompressedData[ InChunkOffset + index2/2 ] >> ((index2&1)*4) ) & 0x0f ) << ((x&1)*4);
++index2;
@@ -798,7 +798,7 @@ void cWSSCompact::cPAKFile::UpdateChunk2To3()
InChunkOffset += index2 / 2;
index2 = 0;
- for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y )
+ for (int x = 0; x < 16; ++x ) for (int z = 0; z < 16; ++z ) for (int y = 0; y < 256; ++y )
{
ConvertedData[ InChunkOffset + MAKE_3_INDEX(x, y, z)/2 ] |= ( (UncompressedData[ InChunkOffset + index2/2 ] >> ((index2&1)*4) ) & 0x0f ) << ((x&1)*4);
++index2;
@@ -887,7 +887,7 @@ bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int a_Uncompre
{
Json::Value root; // will contain the root value after parsing.
Json::Reader reader;
- if ( !reader.parse( UncompressedData.data() + cChunkDef::BlockDataSize, root, false ) )
+ if (!reader.parse( UncompressedData.data() + cChunkDef::BlockDataSize, root, false ) )
{
LOGERROR("Failed to parse trailing JSON in chunk [%d, %d]!",
a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ
@@ -970,7 +970,7 @@ bool cWSSCompact::cPAKFile::SaveChunkToData(const cChunkCoords & a_Chunk, cWorld
// Compress the data:
AString CompressedData;
int errorcode = CompressString(Data.data(), Data.size(), CompressedData, m_CompressionFactor);
- if ( errorcode != Z_OK )
+ if (errorcode != Z_OK )
{
LOGERROR("Error %i compressing data for chunk [%d, %d, %d]", errorcode, a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ);
return false;