From 8d7ab10efa52d4792cdacfcb272be68391b09af1 Mon Sep 17 00:00:00 2001 From: treeston Date: Fri, 5 Aug 2016 12:41:56 +0200 Subject: Scripts/SmartAI: Some clean-up work: - NULL -> nullptr - Rename "AssistPlayerInCombat(who)" to "AssistPlayerInCombatAgainst(who)" to reflect what the method actually does - Code style No functionality was changed. (cherry picked from commit 152b3ad5b997f4be06c5bb55ddb15c57a8e28c3b) # Conflicts: # src/server/game/AI/SmartScripts/SmartAI.cpp # src/server/game/AI/SmartScripts/SmartScript.cpp --- src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp | 4 ++-- src/server/game/AI/ScriptedAI/ScriptedEscortAI.h | 2 +- src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp | 4 ++-- src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/server/game/AI/ScriptedAI') diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 0d64baf1c7f..3f9fb16c6af 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -66,7 +66,7 @@ void npc_escortAI::AttackStart(Unit* who) } //see followerAI -bool npc_escortAI::AssistPlayerInCombat(Unit* who) +bool npc_escortAI::AssistPlayerInCombatAgainst(Unit* who) { if (!who || !who->GetVictim()) return false; @@ -107,7 +107,7 @@ void npc_escortAI::MoveInLineOfSight(Unit* who) { if (me->HasReactState(REACT_AGGRESSIVE) && !me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me)) { - if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(who)) + if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombatAgainst(who)) return; if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h index 0a4471189c1..e1bf3af5343 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h @@ -109,7 +109,7 @@ struct TC_GAME_API npc_escortAI : public ScriptedAI Player* GetPlayerForEscort() { return ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID); } private: - bool AssistPlayerInCombat(Unit* who); + bool AssistPlayerInCombatAgainst(Unit* who); bool IsPlayerOrGroupInRange(); void FillPointMovementListForCreature(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index c255993448a..4a75c2a2c6f 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -63,7 +63,7 @@ void FollowerAI::AttackStart(Unit* who) //This part provides assistance to a player that are attacked by who, even if out of normal aggro range //It will cause me to attack who that are attacking _any_ player (which has been confirmed may happen also on offi) //The flag (type_flag) is unconfirmed, but used here for further research and is a good candidate. -bool FollowerAI::AssistPlayerInCombat(Unit* who) +bool FollowerAI::AssistPlayerInCombatAgainst(Unit* who) { if (!who || !who->GetVictim()) return false; @@ -104,7 +104,7 @@ void FollowerAI::MoveInLineOfSight(Unit* who) { if (me->HasReactState(REACT_AGGRESSIVE) && !me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me)) { - if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(who)) + if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombatAgainst(who)) return; if (!me->CanFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h index b3f8110836c..6b5b06490f0 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.h @@ -69,7 +69,7 @@ class TC_GAME_API FollowerAI : public ScriptedAI void AddFollowState(uint32 uiFollowState) { m_uiFollowState |= uiFollowState; } void RemoveFollowState(uint32 uiFollowState) { m_uiFollowState &= ~uiFollowState; } - bool AssistPlayerInCombat(Unit* who); + bool AssistPlayerInCombatAgainst(Unit* who); ObjectGuid m_uiLeaderGUID; uint32 m_uiUpdateFollowTimer; -- cgit v1.2.3