[Cleanup] Cleaning up Raid.cpp (#3125)

* [Cleanup] Cleanup Raid.cpp

* cleanup

* fix is_bot instances

* bracket cleanup

* bracket cleanup

* rename variables in struct

* fix for merge
This commit is contained in:
Aeadoin
2023-03-20 11:39:14 -04:00
committed by GitHub
parent 2415645b86
commit d6b954a4b9
33 changed files with 846 additions and 779 deletions
+27 -15
View File
@@ -1555,16 +1555,18 @@ void EntityList::RemoveFromAutoXTargets(Mob *mob)
void EntityList::RefreshAutoXTargets(Client *c)
{
if (!c)
if (!c) {
return;
}
auto it = mob_list.begin();
while (it != mob_list.end()) {
Mob *m = it->second;
++it;
if (!m || m->GetHP() <= 0)
if (!m || m->GetHP() <= 0) {
continue;
}
if ((m->CheckAggro(c) || m->IsOnFeignMemory(c)) && !c->IsXTarget(m)) {
c->AddAutoXTarget(m, false); // we only call this before a bulk, so lets not send right away
@@ -1576,19 +1578,22 @@ void EntityList::RefreshAutoXTargets(Client *c)
void EntityList::RefreshClientXTargets(Client *c)
{
if (!c)
if (!c) {
return;
}
auto it = client_list.begin();
while (it != client_list.end()) {
Client *c2 = it->second;
++it;
if (!c2)
if (!c2) {
continue;
}
if (c2->IsClientXTarget(c))
if (c2->IsClientXTarget(c)) {
c2->UpdateClientXTarget(c);
}
}
}
@@ -2222,7 +2227,7 @@ Raid* EntityList::GetRaidByBotName(const char* name)
std::list<RaidMember> rm;
auto GetMembersWithNames = [&rm](Raid const* r) -> std::list<RaidMember> {
for (const auto& m : r->members) {
if (strlen(m.membername) > 0)
if (strlen(m.member_name) > 0)
rm.push_back(m);
}
return rm;
@@ -2230,7 +2235,7 @@ Raid* EntityList::GetRaidByBotName(const char* name)
for (const auto& r : raid_list) {
for (const auto& m : GetMembersWithNames(r)) {
if (strcmp(m.membername, name) == 0) {
if (strcmp(m.member_name, name) == 0) {
return r;
}
}
@@ -2243,7 +2248,7 @@ Raid* EntityList::GetRaidByBot(const Bot* bot)
std::list<RaidMember> rm;
auto GetMembersWhoAreBots = [&rm](Raid* r) -> std::list<RaidMember> {
for (auto const& m : r->members) {
if (m.IsBot) {
if (m.is_bot) {
rm.push_back(m);
}
}
@@ -4890,8 +4895,9 @@ void EntityList::SendZoneAppearance(Client *c)
void EntityList::SendNimbusEffects(Client *c)
{
if (!c)
if (!c) {
return;
}
auto it = mob_list.begin();
while (it != mob_list.end()) {
@@ -4918,8 +4924,9 @@ void EntityList::SendNimbusEffects(Client *c)
void EntityList::SendUntargetable(Client *c)
{
if (!c)
if (!c) {
return;
}
auto it = mob_list.begin();
while (it != mob_list.end()) {
@@ -4930,8 +4937,9 @@ void EntityList::SendUntargetable(Client *c)
++it;
continue;
}
if (!cur->IsTargetable())
if (!cur->IsTargetable()) {
cur->SendTargetable(false, c);
}
}
++it;
}
@@ -4939,8 +4947,9 @@ void EntityList::SendUntargetable(Client *c)
void EntityList::SendAppearanceEffects(Client *c)
{
if (!c)
if (!c) {
return;
}
auto it = mob_list.begin();
while (it != mob_list.end()) {
@@ -5429,8 +5438,9 @@ void EntityList::DeleteQGlobal(std::string name, uint32 npcID, uint32 charID, ui
void EntityList::SendFindableNPCList(Client *c)
{
if (!c)
if (!c) {
return;
}
auto outapp = new EQApplicationPacket(OP_SendFindableNPCs, sizeof(FindableNPC_Struct));
@@ -5496,8 +5506,9 @@ void EntityList::UpdateFindableNPCState(NPC *n, bool Remove)
void EntityList::HideCorpses(Client *c, uint8 CurrentMode, uint8 NewMode)
{
if (!c)
if (!c) {
return;
}
if (NewMode == HideCorpseNone) {
SendZoneCorpses(c);
@@ -5509,8 +5520,9 @@ void EntityList::HideCorpses(Client *c, uint8 CurrentMode, uint8 NewMode)
if (NewMode == HideCorpseAllButGroup) {
g = c->GetGroup();
if (!g)
if (!g) {
NewMode = HideCorpseAll;
}
}
auto it = corpse_list.begin();