diff options
author | Machiavelli <none@none> | 2009-06-10 08:45:45 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2009-06-10 08:45:45 +0200 |
commit | ee9beadbc20d24ec11346858db36c029c9c04b90 (patch) | |
tree | ad8d5f89f9b7e1418c5bc00990370224b91453f3 /src/game/Unit.cpp | |
parent | f137dc02ecadb515928655dd6603f33187731fec (diff) | |
parent | c9d9ae1e491243f82be5ac84dc2ad51dfbae35eb (diff) |
Merge
--HG--
branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r-- | src/game/Unit.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7704e4e0daa..39a14825573 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -80,7 +80,7 @@ static bool procPrepared = InitTriggerAuraData(); Unit::Unit() : WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this) -, m_IsInNotifyList(false), m_Notified(false), IsAIEnabled(false), NeedChangeAI(false) +, m_NotifyListPos(-1), m_Notified(false), IsAIEnabled(false), NeedChangeAI(false) , i_AI(NULL), i_disabledAI(NULL), m_removedAurasCount(0), m_Vehicle(NULL), m_transport(NULL) , m_ControlledByPlayer(false), m_procDeep(0) { @@ -10450,8 +10450,7 @@ void Unit::SetVisibility(UnitVisibility x) { m_Visibility = x; - if(IsInWorld()) - SetToNotify(); + SetToNotify(); if(x == VISIBILITY_GROUP_STEALTH) DestroyForNearbyPlayers(); @@ -11685,7 +11684,8 @@ void Unit::AddToWorld() { WorldObject::AddToWorld(); m_Notified = false; - m_IsInNotifyList = false; + //assert(m_NotifyListPos < 0); instance : crash + m_NotifyListPos = -1; SetToNotify(); } } @@ -11704,6 +11704,12 @@ void Unit::RemoveFromWorld() RemoveNotOwnSingleTargetAuras(); ExitVehicle(); + if(m_NotifyListPos >= 0) + { + GetMap()->RemoveUnitFromNotify(m_NotifyListPos); + m_NotifyListPos = -1; + } + if(GetCharmerGUID()) { sLog.outCrash("Unit %u has charmer guid when removed from world", GetEntry()); @@ -13229,11 +13235,9 @@ bool Unit::HandleAuraRaidProcFromCharge( AuraEffect* triggeredByAura ) void Unit::SetToNotify() { - if(m_IsInNotifyList) - return; - - if(Map *map = GetMap()) - map->AddUnitToNotify(this); + // it is called somewhere when obj is not in world (crash when log in instance) + if(m_NotifyListPos < 0) + GetMap()->AddUnitToNotify(this); } void Unit::Kill(Unit *pVictim, bool durabilityLoss) @@ -13668,7 +13672,7 @@ void Unit::SetCharmedBy(Unit* charmer, CharmType type) if(cinfo && cinfo->type == CREATURE_TYPE_DEMON) { //to prevent client crash - //SetFlag(UNIT_FIELD_BYTES_0, 2048); + SetByteValue(UNIT_FIELD_BYTES_0, 1, (uint8)CLASS_MAGE); //just to enable stat window if(GetCharmInfo()) @@ -13763,6 +13767,7 @@ void Unit::RemoveCharmedBy(Unit *charmer) CreatureInfo const *cinfo = ((Creature*)this)->GetCreatureInfo(); if(cinfo && cinfo->type == CREATURE_TYPE_DEMON) { + SetByteValue(UNIT_FIELD_BYTES_0, 1, uint8(cinfo->unit_class)); if(GetCharmInfo()) GetCharmInfo()->SetPetNumber(0, true); else |