From 23f643b484171115b34a3c97ca006ff7aee025d2 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 28 Mar 2009 11:56:45 -0600 Subject: *Fix a crash when player toggle autocast for guardians. --HG-- branch : trunk --- src/game/PetHandler.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 79788d7a234..15f807a3cce 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -381,18 +381,19 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data ) //sign for autocast if(act_state == ACT_ENABLED && spell_id) { - if(pet->isCharmed()) - charmInfo->ToggleCreatureAutocast(spell_id, true); - else if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet()) + if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet()) ((Pet*)pet)->ToggleAutocast(spell_id, true); + else + charmInfo->ToggleCreatureAutocast(spell_id, true); } //sign for no/turn off autocast else if(act_state == ACT_DISABLED && spell_id) { - if(pet->isCharmed()) - charmInfo->ToggleCreatureAutocast(spell_id, false); - else if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet()) + if(pet->GetTypeId() == TYPEID_UNIT && ((Creature*)pet)->isPet()) ((Pet*)pet)->ToggleAutocast(spell_id, false); + else + charmInfo->ToggleCreatureAutocast(spell_id, false); + } charmInfo->GetActionBarEntry(position)->Type = act_state; @@ -570,11 +571,10 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket ) return; } - if(pet->isCharmed()) - //state can be used as boolean - pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state); - else + if(pet->isPet()) ((Pet*)pet)->ToggleAutocast(spellid, state); + else + pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state); for(uint8 i = 0; i < 10; ++i) { -- cgit v1.2.3