refactor(Core/Misc): isEmpty to IsEmpty (#10011)

This commit is contained in:
Kitzunu
2022-01-14 03:43:15 +01:00
committed by GitHub
parent e36ee257c7
commit d1cc65b1c7
50 changed files with 94 additions and 94 deletions

View File

@@ -106,7 +106,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= nullptr*/, float maxRange
}
Map::PlayerList const& playerList = map->GetPlayers();
if (playerList.isEmpty())
if (playerList.IsEmpty())
{
return;
}

View File

@@ -255,7 +255,7 @@ void ScriptedAI::DoPlayMusic(uint32 soundId, bool zone)
Map::PlayerList const& players = me->GetMap()->GetPlayers();
targets = new ObjectList();
if (!players.isEmpty())
if (!players.IsEmpty())
{
for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
if (Player* player = i->GetSource())

View File

@@ -301,7 +301,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
Map::PlayerList const& players = me->GetMap()->GetPlayers();
targets = new ObjectList();
if (!players.isEmpty())
if (!players.IsEmpty())
{
for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
if (Player* player = i->GetSource())
@@ -350,7 +350,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
Map::PlayerList const& players = me->GetMap()->GetPlayers();
targets = new ObjectList();
if (!players.isEmpty())
if (!players.IsEmpty())
{
for (Map::PlayerList::const_iterator i = players.begin(); i != players.end(); ++i)
if (Player* player = i->GetSource())

View File

@@ -63,7 +63,7 @@ void FormationMgr::RemoveCreatureFromGroup(CreatureGroup* group, Creature* membe
LOG_DEBUG("entities.unit", "Deleting member pointer to spawnId: %u from group %u", member->GetSpawnId(), group->GetId());
group->RemoveMember(member);
if (group->isEmpty())
if (group->IsEmpty())
{
Map* map = member->FindMap();
if (!map)

View File

@@ -93,7 +93,7 @@ public:
Creature* getLeader() const { return m_leader; }
uint32 GetId() const { return m_groupID; }
bool isEmpty() const { return m_members.empty(); }
bool IsEmpty() const { return m_members.empty(); }
bool isFormed() const { return m_Formed; }
const CreatureGroupMemberType& GetMembers() const { return m_members; }

View File

@@ -124,7 +124,7 @@ void MotionTransport::CleanupsBeforeDelete(bool finalCleanup /*= true*/)
void MotionTransport::BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet&)
{
Map::PlayerList const& players = GetMap()->GetPlayers();
if (players.isEmpty())
if (players.IsEmpty())
return;
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
@@ -798,7 +798,7 @@ void StaticTransport::CleanupsBeforeDelete(bool finalCleanup /*= true*/)
void StaticTransport::BuildUpdate(UpdateDataMapType& data_map, UpdatePlayerSet&)
{
Map::PlayerList const& players = GetMap()->GetPlayers();
if (players.isEmpty())
if (players.IsEmpty())
return;
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)

View File

@@ -416,7 +416,7 @@ void Unit::Update(uint32 p_time)
// Check UNIT_STATE_MELEE_ATTACKING or UNIT_STATE_CHASE (without UNIT_STATE_FOLLOW in this case) so pets can reach far away
// targets without stopping half way there and running off.
// These flags are reset after target dies or another command is given.
if (m_HostileRefMgr.isEmpty())
if (m_HostileRefMgr.IsEmpty())
{
// m_CombatTimer set at aura start and it will be freeze until aura removing
if (m_CombatTimer <= p_time)

View File

@@ -115,12 +115,12 @@ public:
/*bool NoWorldObjectInGrid() const
{
return i_objects.GetElements().isEmpty();
return i_objects.GetElements().IsEmpty();
}
bool NoGridObjectInGrid() const
{
return i_container.GetElements().isEmpty();
return i_container.GetElements().IsEmpty();
}*/
private:
TypeMapContainer<GRID_OBJECT_TYPES> i_container;

View File

@@ -200,7 +200,7 @@ void ObjectGridLoader::LoadN(void)
template<class T>
void ObjectGridUnloader::Visit(GridRefMgr<T>& m)
{
while (!m.isEmpty())
while (!m.IsEmpty())
{
T* obj = m.getFirst()->GetSource();
// if option set then object already saved at this moment

View File

@@ -126,7 +126,7 @@ void WorldSession::HandleMoveWorldportAck()
_player->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
}
if (!_player->getHostileRefMgr().isEmpty())
if (!_player->getHostileRefMgr().IsEmpty())
_player->getHostileRefMgr().deleteReferences(true); // pussywizard: multithreading crashfix
CellCoord pair(Acore::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()));

View File

@@ -412,7 +412,7 @@ void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData)
{
Map::PlayerList const& lPlayers = instance->GetPlayers();
if (!lPlayers.isEmpty())
if (!lPlayers.IsEmpty())
{
for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr)
if (Player* player = itr->GetSource())
@@ -429,7 +429,7 @@ void InstanceScript::DoSendNotifyToInstance(char const* format, ...)
{
InstanceMap::PlayerList const& players = instance->GetPlayers();
if (!players.isEmpty())
if (!players.IsEmpty())
{
va_list ap;
va_start(ap, format);
@@ -447,7 +447,7 @@ void InstanceScript::DoUpdateAchievementCriteria(AchievementCriteriaTypes type,
{
Map::PlayerList const& PlayerList = instance->GetPlayers();
if (!PlayerList.isEmpty())
if (!PlayerList.IsEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* player = i->GetSource())
player->UpdateAchievementCriteria(type, miscValue1, miscValue2, unit);
@@ -458,7 +458,7 @@ void InstanceScript::DoStartTimedAchievement(AchievementCriteriaTimedTypes type,
{
Map::PlayerList const& PlayerList = instance->GetPlayers();
if (!PlayerList.isEmpty())
if (!PlayerList.IsEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* player = i->GetSource())
player->StartTimedAchievement(type, entry);
@@ -469,7 +469,7 @@ void InstanceScript::DoStopTimedAchievement(AchievementCriteriaTimedTypes type,
{
Map::PlayerList const& PlayerList = instance->GetPlayers();
if (!PlayerList.isEmpty())
if (!PlayerList.IsEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* player = i->GetSource())
player->RemoveTimedAchievement(type, entry);
@@ -479,7 +479,7 @@ void InstanceScript::DoStopTimedAchievement(AchievementCriteriaTimedTypes type,
void InstanceScript::DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
{
Map::PlayerList const& PlayerList = instance->GetPlayers();
if (!PlayerList.isEmpty())
if (!PlayerList.IsEmpty())
{
for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr)
{
@@ -498,7 +498,7 @@ void InstanceScript::DoCastSpellOnPlayers(uint32 spell)
{
Map::PlayerList const& PlayerList = instance->GetPlayers();
if (!PlayerList.isEmpty())
if (!PlayerList.IsEmpty())
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* player = i->GetSource())
player->CastSpell(player, spell, true);

View File

@@ -628,7 +628,7 @@ bool Map::AddToMap(MotionTransport* obj, bool /*checkTransport*/)
_transports.insert(obj);
// Broadcast creation to players
if (!GetPlayers().isEmpty())
if (!GetPlayers().IsEmpty())
{
for (Map::PlayerList::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
@@ -957,7 +957,7 @@ void Map::RemoveFromMap(MotionTransport* obj, bool remove)
RemoveFromActive(obj);
Map::PlayerList const& players = GetPlayers();
if (!players.isEmpty())
if (!players.IsEmpty())
{
UpdateData data;
obj->BuildOutOfRangeUpdateBlock(&data);
@@ -2873,7 +2873,7 @@ Map::EnterState InstanceMap::CannotEnter(Player* player, bool loginCheck)
// cannot enter if instance is in use by another party/soloer that have a permanent save in the same instance id
PlayerList const& playerList = GetPlayers();
if (!playerList.isEmpty())
if (!playerList.IsEmpty())
for (PlayerList::const_iterator i = playerList.begin(); i != playerList.end(); ++i)
if (Player* iPlayer = i->GetSource())
{
@@ -3066,7 +3066,7 @@ bool InstanceMap::Reset(uint8 method, GuidList* globalResetSkipList)
m_resetAfterUnload = true;
}
return m_mapRefMgr.isEmpty();
return m_mapRefMgr.IsEmpty();
}
if (HavePlayers())
@@ -3083,7 +3083,7 @@ bool InstanceMap::Reset(uint8 method, GuidList* globalResetSkipList)
m_resetAfterUnload = true;
}
return m_mapRefMgr.isEmpty();
return m_mapRefMgr.IsEmpty();
}
std::string const& InstanceMap::GetScriptName() const
@@ -3679,7 +3679,7 @@ void Map::SendZoneDynamicInfo(Player* player)
void Map::PlayDirectSoundToMap(uint32 soundId, uint32 zoneId)
{
Map::PlayerList const& players = GetPlayers();
if (!players.isEmpty())
if (!players.IsEmpty())
{
WorldPacket data(SMSG_PLAY_SOUND, 4);
data << uint32(soundId);
@@ -3699,7 +3699,7 @@ void Map::SetZoneMusic(uint32 zoneId, uint32 musicId)
_zoneDynamicInfo[zoneId].MusicId = musicId;
Map::PlayerList const& players = GetPlayers();
if (!players.isEmpty())
if (!players.IsEmpty())
{
WorldPacket data(SMSG_PLAY_MUSIC, 4);
data << uint32(musicId);
@@ -3721,7 +3721,7 @@ void Map::SetZoneWeather(uint32 zoneId, WeatherState weatherId, float weatherGra
info.WeatherGrade = weatherGrade;
Map::PlayerList const& players = GetPlayers();
if (!players.isEmpty())
if (!players.IsEmpty())
{
WorldPackets::Misc::Weather weather(weatherId, weatherGrade);
@@ -3742,7 +3742,7 @@ void Map::SetZoneOverrideLight(uint32 zoneId, uint32 lightId, Milliseconds fadeI
info.LightFadeInTime = static_cast<uint32>(fadeInTime.count());
Map::PlayerList const& players = GetPlayers();
if (!players.isEmpty())
if (!players.IsEmpty())
{
WorldPacket data(SMSG_OVERRIDE_LIGHT, 4 + 4 + 4);
data << uint32(_defaultLight);

View File

@@ -462,7 +462,7 @@ public:
bool isCellMarkedLarge(uint32 pCellId) { return marked_cells_large.test(pCellId); }
void markCellLarge(uint32 pCellId) { marked_cells_large.set(pCellId); }
[[nodiscard]] bool HavePlayers() const { return !m_mapRefMgr.isEmpty(); }
[[nodiscard]] bool HavePlayers() const { return !m_mapRefMgr.IsEmpty(); }
[[nodiscard]] uint32 GetPlayersCountExceptGMs() const;
void AddWorldObject(WorldObject* obj) { i_worldObjects.insert(obj); }

View File

@@ -973,7 +973,7 @@ void PoolMgr::SaveQuestsToDB(bool daily, bool weekly, bool other)
std::set<uint32> deletedPools;
for (PoolGroupQuestMap::iterator itr = mPoolQuestGroups.begin(); itr != mPoolQuestGroups.end(); ++itr)
{
if (itr->second.isEmpty())
if (itr->second.IsEmpty())
continue;
if (Quest const* quest = sObjectMgr->GetQuestTemplate(itr->second.GetFirstEqualChancedObjectId()))
{
@@ -1041,7 +1041,7 @@ template<>
void PoolMgr::SpawnPool<Creature>(uint32 pool_id, uint32 db_guid)
{
auto it = mPoolCreatureGroups.find(pool_id);
if (it != mPoolCreatureGroups.end() && !it->second.isEmpty())
if (it != mPoolCreatureGroups.end() && !it->second.IsEmpty())
it->second.SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, db_guid);
}
@@ -1051,7 +1051,7 @@ template<>
void PoolMgr::SpawnPool<GameObject>(uint32 pool_id, uint32 db_guid)
{
auto it = mPoolGameobjectGroups.find(pool_id);
if (it != mPoolGameobjectGroups.end() && !it->second.isEmpty())
if (it != mPoolGameobjectGroups.end() && !it->second.IsEmpty())
it->second.SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, db_guid);
}
@@ -1061,7 +1061,7 @@ template<>
void PoolMgr::SpawnPool<Pool>(uint32 pool_id, uint32 sub_pool_id)
{
auto it = mPoolPoolGroups.find(pool_id);
if (it != mPoolPoolGroups.end() && !it->second.isEmpty())
if (it != mPoolPoolGroups.end() && !it->second.IsEmpty())
it->second.SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, sub_pool_id);
}
@@ -1070,7 +1070,7 @@ template<>
void PoolMgr::SpawnPool<Quest>(uint32 pool_id, uint32 quest_id)
{
auto it = mPoolQuestGroups.find(pool_id);
if (it != mPoolQuestGroups.end() && !it->second.isEmpty())
if (it != mPoolQuestGroups.end() && !it->second.IsEmpty())
it->second.SpawnObject(mSpawnedData, mPoolTemplate[pool_id].MaxLimit, quest_id);
}
@@ -1087,22 +1087,22 @@ void PoolMgr::DespawnPool(uint32 pool_id)
{
{
auto it = mPoolCreatureGroups.find(pool_id);
if (it != mPoolCreatureGroups.end() && !it->second.isEmpty())
if (it != mPoolCreatureGroups.end() && !it->second.IsEmpty())
it->second.DespawnObject(mSpawnedData);
}
{
auto it = mPoolGameobjectGroups.find(pool_id);
if (it != mPoolGameobjectGroups.end() && !it->second.isEmpty())
if (it != mPoolGameobjectGroups.end() && !it->second.IsEmpty())
it->second.DespawnObject(mSpawnedData);
}
{
auto it = mPoolPoolGroups.find(pool_id);
if (it != mPoolPoolGroups.end() && !it->second.isEmpty())
if (it != mPoolPoolGroups.end() && !it->second.IsEmpty())
it->second.DespawnObject(mSpawnedData);
}
{
auto it = mPoolQuestGroups.find(pool_id);
if (it != mPoolQuestGroups.end() && !it->second.isEmpty())
if (it != mPoolQuestGroups.end() && !it->second.IsEmpty())
it->second.DespawnObject(mSpawnedData);
}
}

View File

@@ -72,7 +72,7 @@ public:
explicit PoolGroup() : poolId(0) { }
void SetPoolId(uint32 pool_id) { poolId = pool_id; }
~PoolGroup() {};
bool isEmpty() const { return ExplicitlyChanced.empty() && EqualChanced.empty(); }
bool IsEmpty() const { return ExplicitlyChanced.empty() && EqualChanced.empty(); }
void AddEntry(PoolObject& poolitem, uint32 maxentries);
bool CheckPool() const;
void DespawnObject(ActivePoolData& spawns, ObjectGuid::LowType guid = 0);

View File

@@ -657,7 +657,7 @@ void WorldSession::LogoutPlayer(bool save)
Map::PlayerList const& playerList = _player->GetMap()->GetPlayers();
if (_player->GetMap()->IsDungeon() || _player->GetMap()->IsRaidOrHeroicDungeon())
if (playerList.isEmpty())
if (playerList.IsEmpty())
_player->TeleportToEntryPoint();
}