diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/NPCHandler.cpp | 2 | ||||
-rw-r--r-- | src/game/Object.cpp | 3 | ||||
-rw-r--r-- | src/game/Player.cpp | 6 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 3 |
4 files changed, 14 insertions, 0 deletions
diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index a412f91b30c..31b539abd05 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -678,6 +678,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) Pet *newpet = new Pet(_player, HUNTER_PET); if(!newpet->LoadPetFromDB(_player,creature_id,petnumber)) { + newpet->CleanupsBeforeDelete(); delete newpet; newpet = NULL; WorldPacket data(SMSG_STABLE_RESULT, 1); @@ -796,6 +797,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) Pet *newpet = new Pet(_player); if(!newpet->LoadPetFromDB(_player,creature_id,pet_number)) { + newpet->CleanupsBeforeDelete(); delete newpet; data << uint8(0x06); } diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 28c50a9e38e..104fb26e99f 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1828,6 +1828,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy // petentry==0 for hunter "call pet" (current pet summoned if any) if(!entry) { + pet->CleanupsBeforeDelete(); delete pet; return NULL; } @@ -1836,6 +1837,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy if(!pet->IsPositionValid()) { sLog.outError("ERROR: Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)",pet->GetGUIDLow(),pet->GetEntry(),pet->GetPositionX(),pet->GetPositionY()); + pet->CleanupsBeforeDelete(); delete pet; return NULL; } @@ -1845,6 +1847,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy if(!pet->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number)) { sLog.outError("no such creature entry %u", entry); + pet->CleanupsBeforeDelete(); delete pet; return NULL; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index b1db9d75107..48e4901a9e0 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -16462,7 +16462,10 @@ void Player::LoadPet() { Pet *pet = new Pet(this); if (!pet->LoadPetFromDB(this,0,0,true)) + { + pet->CleanupsBeforeDelete(); delete pet; + } } } @@ -22455,7 +22458,10 @@ void Player::ResummonPetTemporaryUnSummonedIfAny() Pet* NewPet = new Pet(this); if(!NewPet->LoadPetFromDB(this, 0, m_temporaryUnsummonedPetNumber, true)) + { + NewPet->CleanupsBeforeDelete(); delete NewPet; + } m_temporaryUnsummonedPetNumber = 0; } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 76f2af18c50..bf48dfaddc9 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4855,7 +4855,10 @@ void Spell::EffectScriptEffect(uint32 effIndex) } } else + { + NewPet->CleanupsBeforeDelete(); delete NewPet; + } } } return; |