1
0

Merge pull request #1707 from UltraCoderRU/master

Fixed some problems found by CppCheck
This commit is contained in:
Mattes D 2015-01-17 19:52:26 +01:00
commit 50918a5214
8 changed files with 11 additions and 11 deletions

View File

@ -771,7 +771,7 @@ bool cPluginManager::CallHookPlayerFoodLevelChange(cPlayer & a_Player, int a_New
bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, const cItems a_Reward)
bool cPluginManager::CallHookPlayerFished(cPlayer & a_Player, const cItems & a_Reward)
{
FIND_HOOK(HOOK_PLAYER_FISHED);
VERIFY_HOOK;
@ -847,7 +847,7 @@ bool cPluginManager::CallHookPlayerLeftClick(cPlayer & a_Player, int a_BlockX, i
bool cPluginManager::CallHookPlayerMoving(cPlayer & a_Player, const Vector3d a_OldPosition, const Vector3d a_NewPosition)
bool cPluginManager::CallHookPlayerMoving(cPlayer & a_Player, const Vector3d & a_OldPosition, const Vector3d & a_NewPosition)
{
FIND_HOOK(HOOK_PLAYER_MOVING);
VERIFY_HOOK;

View File

@ -203,12 +203,12 @@ public:
bool CallHookPlayerBrokenBlock (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
bool CallHookPlayerDestroyed (cPlayer & a_Player);
bool CallHookPlayerEating (cPlayer & a_Player);
bool CallHookPlayerFished (cPlayer & a_Player, const cItems a_Reward);
bool CallHookPlayerFished (cPlayer & a_Player, const cItems & a_Reward);
bool CallHookPlayerFishing (cPlayer & a_Player, cItems a_Reward);
bool CallHookPlayerFoodLevelChange (cPlayer & a_Player, int a_NewFoodLevel);
bool CallHookPlayerJoined (cPlayer & a_Player);
bool CallHookPlayerLeftClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
bool CallHookPlayerMoving (cPlayer & a_Player, const Vector3d a_OldPosition, const Vector3d a_NewPosition);
bool CallHookPlayerMoving (cPlayer & a_Player, const Vector3d & a_OldPosition, const Vector3d & a_NewPosition);
bool CallHookPlayerPlacedBlock (cPlayer & a_Player, const sSetBlock & a_BlockChange);
bool CallHookPlayerPlacingBlock (cPlayer & a_Player, const sSetBlock & a_BlockChange);
bool CallHookPlayerRightClick (cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ);

View File

@ -197,7 +197,7 @@ void cLightingThread::Execute(void)
{
{
cCSLock Lock(m_CS);
if (m_Queue.size() == 0)
if (m_Queue.empty())
{
cCSUnlock Unlock(Lock);
m_evtItemAdded.Wait();

View File

@ -50,7 +50,7 @@ cMobProximityCounter::sIterablePair cMobProximityCounter::getMobWithinThosesDist
a_DistanceMin *= a_DistanceMin;// this is because is use square distance
a_DistanceMax *= a_DistanceMax;
if (m_DistanceToMonster.size() <= 0)
if (m_DistanceToMonster.empty())
{
convertMaps();
}

View File

@ -86,7 +86,7 @@ public:
bool TryDequeueItem(ItemType & item)
{
cCSLock Lock(m_CS);
if (m_Contents.size() == 0)
if (m_Contents.empty())
{
return false;
}
@ -101,7 +101,7 @@ public:
ItemType DequeueItem(void)
{
cCSLock Lock(m_CS);
while (m_Contents.size() == 0)
while (m_Contents.empty())
{
cCSUnlock Unlock(Lock);
m_evtAdded.Wait();

View File

@ -639,7 +639,7 @@ bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallbac
bool cRoot::DoWithPlayerByUUID(const AString & a_PlayerUUID, cPlayerListCallback & a_Callback)
{
for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end();itr++)
for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr)
{
if (itr->second->DoWithPlayerByUUID(a_PlayerUUID, a_Callback))
{

View File

@ -764,7 +764,7 @@ void cServer::cNotifyWriteThread::Execute(void)
while (!m_ShouldTerminate)
{
cCSLock Lock(m_CS);
while (m_Clients.size() == 0)
while (m_Clients.empty())
{
cCSUnlock Unlock(Lock);
m_Event.Wait();

View File

@ -132,7 +132,7 @@ void cSetChunkData::RemoveInvalidBlockEntities(void)
ItemTypeToString(WorldBlockType).c_str(), WorldBlockType
);
cBlockEntityList::iterator itr2 = itr;
itr2++;
++itr2;
delete *itr;
m_BlockEntities.erase(itr);
itr = itr2;