aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-04-13 12:11:36 -0500
committermegamage <none@none>2009-04-13 12:11:36 -0500
commit52571d6d48c14ebfffec68b4f47ad499b431fa45 (patch)
tree70fd24f10922854b81ef50404c316cca9b46e1a4 /src
parent064866bdfef2aa0449572669b99305774c06b738 (diff)
*Fix a 100% crash that pet is killed by DOT.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Pet.cpp9
-rw-r--r--src/game/Player.cpp7
2 files changed, 6 insertions, 10 deletions
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;