diff options
author | megamage <none@none> | 2009-03-21 12:16:14 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-03-21 12:16:14 -0600 |
commit | d0501ab3a12895ad35f009e1a8758aca090f95b5 (patch) | |
tree | a5566fcf271eddb81658cd03600de130c9545ca3 /src | |
parent | 28c03b77ad0bb7a93d98d8b48480225dfdb4c98a (diff) |
*A temp fix for the bug that dismiss pets cause crash.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/PetHandler.cpp | 10 | ||||
-rw-r--r-- | src/game/Unit.cpp | 6 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index f6b6184a32a..a93d9961e85 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -63,9 +63,13 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) if(pet->GetTypeId() == TYPEID_PLAYER && !(flag == ACT_COMMAND && spellid == COMMAND_ATTACK)) return; - for(ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr) - if((*itr)->GetEntry() == pet->GetEntry() && (*itr)->isAlive()) - HandlePetActionHelper(*itr, guid1, spellid, flag, guid2); + for(ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end();) + { + Unit *unit = *itr; + ++itr; + if(unit->GetEntry() == pet->GetEntry() && unit->isAlive()) + HandlePetActionHelper(unit, guid1, spellid, flag, guid2); + } } void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 9bf6b86e513..f3ed7d9d9d6 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -8253,7 +8253,6 @@ Unit* Unit::GetCharm() const void Unit::SetPet(Creature* pet, bool apply) { - sLog.outError("before %u", GetPetGUID()); if(apply) { if(!GetPetGUID()) @@ -8280,7 +8279,6 @@ void Unit::SetPet(Creature* pet, bool apply) } } } - sLog.outError("after %u", GetPetGUID()); } void Unit::SetCharm(Unit* charm, bool apply) @@ -11221,10 +11219,6 @@ void Unit::RemoveFromWorld() RemoveCharmAuras(); RemoveBindSightAuras(); RemoveNotOwnSingleTargetAuras(); - } - - //if(m_uint32Values) - { // if it has charmer or owner, it must be in someone's controllist and server will crash assert(!GetCharmerGUID()); assert(!GetOwnerGUID()); |