refactor(Core): code cleanup (part 2) (#6374)

This commit is contained in:
Francesco Borzì
2021-06-16 20:40:42 +02:00
committed by GitHub
parent 8f7ad83010
commit 466cdb68d6
80 changed files with 198 additions and 209 deletions

View File

@@ -2986,7 +2986,7 @@ void InstanceMap::UnloadAll()
{
ASSERT(!HavePlayers());
if (m_resetAfterUnload == true)
if (m_resetAfterUnload)
{
DeleteRespawnTimes();
DeleteCorpseData();
@@ -3331,9 +3331,9 @@ void Map::LogEncounterFinished(EncounterCreditType type, uint32 creditEntry)
{
std::string auraStr;
const Unit::AuraApplicationMap& a = p->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = a.begin(); itr != a.end(); ++itr)
for (auto iterator = a.begin(); iterator != a.end(); ++iterator)
{
snprintf(buffer2, 255, "%u(%u) ", itr->first, itr->second->GetEffectMask());
snprintf(buffer2, 255, "%u(%u) ", iterator->first, iterator->second->GetEffectMask());
auraStr += buffer2;
}
@@ -3777,7 +3777,7 @@ bool Map::CheckCollisionAndGetValidCoords(const WorldObject* source, float start
}
}
return failOnCollision ? !collided : true;
return !failOnCollision || !collided;
}
void Map::LoadCorpseData()

View File

@@ -13,7 +13,6 @@
#include "ObjectMgr.h"
#include "Player.h"
#include "VMapFactory.h"
#include "World.h"
#ifdef ELUNA
#include "LuaEngine.h"

View File

@@ -5,10 +5,7 @@
*/
#include "AvgDiffTracker.h"
#include "CellImpl.h"
#include "Chat.h"
#include "Config.h"
#include "Corpse.h"
#include "DatabaseEnv.h"
#include "GridDefines.h"
#include "Group.h"
@@ -27,7 +24,6 @@
#include "Transport.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#ifdef ELUNA
#include "LuaEngine.h"
@@ -319,9 +315,13 @@ bool MapManager::IsValidMAP(uint32 mapid, bool startUp)
MapEntry const* mEntry = sMapStore.LookupEntry(mapid);
if (startUp)
return !!mEntry;
{
return mEntry != nullptr;
}
else
{
return mEntry && (!mEntry->IsDungeon() || sObjectMgr->GetInstanceTemplate(mapid));
}
// TODO: add check for battleground template
}