aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortreeston <treeston.mmoc@gmail.com>2016-05-31 22:18:26 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-01-11 23:24:42 +0100
commit2b3cf3d48003f55ced1ebbc1a2c237451e9063bb (patch)
treefb905fd06306c22a6ff9f61a106b311852c75882 /src
parent0301a5a0c9bdf841ab579b3f0cd5c706f40b3c4b (diff)
AI/PlayerAI: Code style cleanup.
(cherry picked from commit e3aa19281f4d1e2437a5654715f75ae919bd4027) Build fix for horrendous, outdated, non-standards-compliant compilers. Such as the one in VS 2013. I hate VS 2013. Closes #17260. (cherry picked from commit 321d35417d39bd2531c63c63cd432cf86d84453f)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/PlayerAI/PlayerAI.cpp15
-rw-r--r--src/server/game/AI/PlayerAI/PlayerAI.h3
2 files changed, 14 insertions, 4 deletions
diff --git a/src/server/game/AI/PlayerAI/PlayerAI.cpp b/src/server/game/AI/PlayerAI/PlayerAI.cpp
index 2f84ad32f2c..a143dd6056a 100644
--- a/src/server/game/AI/PlayerAI/PlayerAI.cpp
+++ b/src/server/game/AI/PlayerAI/PlayerAI.cpp
@@ -451,13 +451,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 {};
diff --git a/src/server/game/AI/PlayerAI/PlayerAI.h b/src/server/game/AI/PlayerAI/PlayerAI.h
index 2d7adc6c551..b06f81f76c9 100644
--- a/src/server/game/AI/PlayerAI/PlayerAI.h
+++ b/src/server/game/AI/PlayerAI/PlayerAI.h
@@ -40,7 +40,8 @@ class TC_GAME_API PlayerAI : public UnitAI
protected:
struct TargetedSpell : public std::pair<Spell*, Unit*>
{
- using std::pair<Spell*, Unit*>::pair;
+ TargetedSpell() : pair<Spell*, Unit*>() { }
+ TargetedSpell(Spell* first, Unit* second) : pair<Spell*, Unit*>(first, second) { }
explicit operator bool() { return !!first; }
};
typedef std::pair<TargetedSpell, uint32> PossibleSpell;