From 89b3a04eb31b3a7d57ec880adff2e8b38640912e Mon Sep 17 00:00:00 2001 From: Alex King <89047260+Kinglykrab@users.noreply.github.com> Date: Wed, 5 Apr 2023 10:30:27 -0400 Subject: [PATCH] [Cleanup] Identical conditions right beside each other in aa.cpp (#3213) # Notes - These conditions were identical and could be consolidated. --- zone/aa.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 2ff5e9d0a..924b3b35f 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1398,27 +1398,28 @@ int Mob::GetAlternateAdvancementCooldownReduction(AA::Rank *rank_in) { void Mob::ExpendAlternateAdvancementCharge(uint32 aa_id) { for (auto &iter : aa_ranks) { - AA::Ability *ability = zone->GetAlternateAdvancementAbility(iter.first); + auto ability = zone->GetAlternateAdvancementAbility(iter.first); if (ability && aa_id == ability->id) { if (iter.second.second > 0) { iter.second.second -= 1; if (iter.second.second == 0) { - if (IsClient()) { - AA::Rank *r = ability->GetRankByPointsSpent(iter.second.first); - if (r) { - CastToClient()->GetEPP().expended_aa += r->cost; - } - } if (IsClient()) { auto c = CastToClient(); + + auto r = ability->GetRankByPointsSpent(iter.second.first); + if (r) { + c->GetEPP().expended_aa += r->cost; + } + c->RemoveExpendedAA(ability->first_rank_id); } + aa_ranks.erase(iter.first); } if (IsClient()) { - Client *c = CastToClient(); + auto c = CastToClient(); c->SaveAA(); c->SendAlternateAdvancementPoints(); }