[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

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

View file

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