Dungeon code cleanup

Consistent code, easier to read logic flow and some missing nullptr checks
This commit is contained in:
Bobblybook
2024-10-20 15:49:10 +11:00
parent a430786133
commit d0a9e98801
16 changed files with 106 additions and 151 deletions

View File

@@ -12,12 +12,12 @@ bool ShatterSpreadAction::Execute(Event event)
GuidVector members = AI_VALUE(GuidVector, "group members");
for (auto& member : members)
{
if (bot->GetGUID() == member)
Unit* unit = botAI->GetUnit(member);
if (!unit || bot->GetGUID() == member)
{
continue;
}
if (!closestMember ||
bot->GetExactDist2d(botAI->GetUnit(member)) < bot->GetExactDist2d(closestMember))
if (!closestMember || bot->GetExactDist2d(unit) < bot->GetExactDist2d(closestMember))
{
closestMember = botAI->GetUnit(member);
}