Merge pull request #3143 from megamage/master

Threat manager. Fix crashes #2396 and #2992.
This commit is contained in:
QAston
2011-09-21 01:03:53 -07:00

View File

@@ -74,6 +74,10 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn
if (!hatedUnit->isAlive() || !hatingUnit->isAlive())
return false;
// not in same map or phase
if (!hatedUnit->IsInMap(hatingUnit))
return false;
// spell not causing threat
if (threatSpell && threatSpell->AttributesEx & SPELL_ATTR1_NO_THREAT)
return false;
@@ -174,11 +178,13 @@ void HostileReference::updateOnlineStatus()
// ref is valid
// target is no player or not gamemaster
// target is not in flight
if (isValid() &&
((getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster()) ||
!getTarget()->HasUnitState(UNIT_STAT_IN_FLIGHT)))
if (isValid()
&& (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster())
&& !getTarget()->HasUnitState(UNIT_STAT_IN_FLIGHT)
&& getTarget()->IsInMap(getSourceUnit())
)
{
Creature* creature = getSourceUnit()->ToCreature();
Creature* creature = getSourceUnit()->ToCreature();
online = getTarget()->isInAccessiblePlaceFor(creature);
if (!online)
{