From 52571d6d48c14ebfffec68b4f47ad499b431fa45 Mon Sep 17 00:00:00 2001 From: megamage Date: Mon, 13 Apr 2009 12:11:36 -0500 Subject: *Fix a 100% crash that pet is killed by DOT. --HG-- branch : trunk --- src/game/Pet.cpp | 9 ++------- src/game/Player.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 4d87a224f7e..86f0ec58db5 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -477,11 +477,7 @@ void Pet::setDeathState(DeathState s) // overwrite virtual Creature::setDeathState(s); if(getDeathState()==CORPSE) { - //remove summoned pet (no corpse) - if(getPetType()==SUMMON_PET) - Remove(PET_SAVE_NOT_IN_SLOT); - // other will despawn at corpse desppawning (Pet::Update code) - else + if(getPetType() == HUNTER_PET) { // pet corpse non lootable and non skinnable SetUInt32Value( UNIT_DYNAMIC_FLAGS, 0x00 ); @@ -511,9 +507,8 @@ void Pet::Update(uint32 diff) { case CORPSE: { - if( m_deathTimer <= diff ) + if(getPetType() != HUNTER_PET || m_deathTimer <= diff ) { - assert(getPetType()!=SUMMON_PET && "Must be already removed."); Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER! return; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 1779ea84d7c..2d7d98579a8 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -16454,18 +16454,19 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) } } - pet->SavePetToDB(mode); - // only if current pet in slot switch(pet->getPetType()) { case POSSESSED_PET: pet->RemoveCharmedOrPossessedBy(NULL); + break; default: - SetGuardian(pet, false); + pet->SavePetToDB(mode); break; } + SetGuardian(pet, false); + pet->CleanupsBeforeDelete(); pet->AddObjectToRemoveList(); pet->m_removed = true; -- cgit v1.2.3