diff options
author | megamage <none@none> | 2009-02-10 10:03:39 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-02-10 10:03:39 -0600 |
commit | 31f49932647433b484bf91a9cc5a56fd44473459 (patch) | |
tree | 685350874e7c3973333543f00c646fb14fb884b9 /src/game/Unit.cpp | |
parent | 22855d6e79e5a7007845b5d6a452aa94cc020b9c (diff) |
[7260] Fixed access to uninitilized fields in FleeingMovementGenerator and Creature::IsOutOfThreatArea. Author: VladimirMangos
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 1de7e266f2f..d1914623dc4 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7427,6 +7427,11 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) if(meleeAttack) addUnitState(UNIT_STAT_MELEE_ATTACKING); + + // set position before any AI calls/assistance + //if(GetTypeId()==TYPEID_UNIT) + // ((Creature*)this)->SetCombatStartPosition(GetPositionX(), GetPositionY(), GetPositionZ()); + m_attacking = victim; m_attacking->_addAttacker(this); @@ -7435,18 +7440,18 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) if(GetTypeId()==TYPEID_UNIT) { + // should not let player enter combat by right clicking target + SetInCombatWith(victim); + if(victim->GetTypeId() == TYPEID_PLAYER) + victim->SetInCombatWith(this); + AddThreat(victim, 0.0f); + WorldPacket data(SMSG_AI_REACTION, 12); data << uint64(GetGUID()); data << uint32(AI_REACTION_AGGRO); // Aggro sound ((WorldObject*)this)->SendMessageToSet(&data, true); ((Creature*)this)->CallAssistance(); - - // should not let player enter combat by right clicking target - SetInCombatWith(victim); - if(victim->GetTypeId() == TYPEID_PLAYER) - victim->SetInCombatWith(this); - AddThreat(victim, 0.0f); } // delay offhand weapon attack to next attack time |