[8119] Speedup code and prevent crash at pet stats reset in time owner not in world.

This commit is contained in:
VladimirMangos 2009-07-05 13:56:31 +04:00
parent 0e1d03baeb
commit 8d2dab1093
2 changed files with 9 additions and 6 deletions

View file

@ -1458,14 +1458,17 @@ void Pet::InitLevelupSpellsForLevel()
bool Pet::unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
{
if(removeSpell(spell_id,learn_prev,clear_ab))
{
if(GetOwner()->GetTypeId() == TYPEID_PLAYER)
{
if(!m_loading)
{
if (Unit* owner = GetOwner())
{
if(owner->GetTypeId() == TYPEID_PLAYER)
{
WorldPacket data(SMSG_PET_REMOVED_SPELL, 4);
data << uint32(spell_id);
((Player*)GetOwner())->GetSession()->SendPacket(&data);
((Player*)owner)->GetSession()->SendPacket(&data);
}
}
}
return true;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8118"
#define REVISION_NR "8119"
#endif // __REVISION_NR_H__