diff options
| author | treeston <treeston.mmoc@gmail.com> | 2016-05-31 22:18:26 +0200 |
|---|---|---|
| committer | treeston <treeston.mmoc@gmail.com> | 2016-05-31 22:18:26 +0200 |
| commit | e3aa19281f4d1e2437a5654715f75ae919bd4027 (patch) | |
| tree | 060fca7b8eb1f59d1b85693c53a21d87cf5da6c5 /src | |
| parent | a0e659434e7c28cc28c1dfeff99510ab658dca4b (diff) | |
AI/PlayerAI: Code style cleanup.
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/AI/PlayerAI/PlayerAI.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/server/game/AI/PlayerAI/PlayerAI.cpp b/src/server/game/AI/PlayerAI/PlayerAI.cpp index b34251b8970..68cb268ac6c 100644 --- a/src/server/game/AI/PlayerAI/PlayerAI.cpp +++ b/src/server/game/AI/PlayerAI/PlayerAI.cpp @@ -575,13 +575,22 @@ PlayerAI::TargetedSpell PlayerAI::VerifySpellCast(uint32 spellId, Unit* target) // Find highest spell rank that we know uint32 knownRank, nextRank; if (me->HasSpell(spellId)) + { // this will save us some lookups if the player has the highest rank (expected case) - nextRank = sSpellMgr->GetNextSpellInChain(knownRank = spellId); + knownRank = spellId; + nextRank = sSpellMgr->GetNextSpellInChain(spellId); + } else - knownRank = 0, nextRank = sSpellMgr->GetFirstSpellInChain(spellId); + { + knownRank = 0; + nextRank = sSpellMgr->GetFirstSpellInChain(spellId); + } while (nextRank && me->HasSpell(nextRank)) - nextRank = sSpellMgr->GetNextSpellInChain(knownRank = nextRank); + { + knownRank = nextRank; + nextRank = sSpellMgr->GetNextSpellInChain(knownRank); + } if (!knownRank) return {}; |
