[10739] Cleanup pet remove code and some fixes.

* Merge Player::RemovePet and Pet::Remove function code to Pet::Unsummon
  This let be sure that in all cases all required steps doen. For example this fix
  creature's guardians propertly remove from guardians list.
* Add new pet save mode PET_SAVE_REAGENTS as replacement PET_SAVE_NOT_IN_SLOT+true-arg stable pair in old function args
  This will avoid use reagent save arg with wrong different save modes.
* Fixed recently added code with absent check for re-summon protector pet call.
This commit is contained in:
VladimirMangos 2010-11-19 02:07:14 +03:00
parent de66f32882
commit f9bcfa3a89
13 changed files with 138 additions and 125 deletions

View file

@ -1213,10 +1213,12 @@ class MANGOS_DLL_SPEC Player : public Unit
time_t GetTimeInnEnter() const { return time_inn_enter; }
void UpdateInnerTime (time_t time) { time_inn_enter = time; }
void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
void RemovePet(PetSaveMode mode);
void RemoveMiniPet();
Pet* GetMiniPet() const;
void SetMiniPet(Pet* pet) { m_miniPet = pet->GetGUID(); }
// use only in Pet::Unsummon/Spell::DoSummon
void _SetMiniPet(Pet* pet) { m_miniPetGuid = pet ? pet->GetObjectGuid() : ObjectGuid(); }
template<typename Func>
void CallForAllControlledUnits(Func const& func, bool withTotems, bool withGuardians, bool withCharms, bool withMiniPet);
@ -2624,7 +2626,7 @@ class MANGOS_DLL_SPEC Player : public Unit
uint32 m_groupUpdateMask;
uint64 m_auraUpdateMask;
uint64 m_miniPet;
ObjectGuid m_miniPetGuid;
// Player summoning
time_t m_summon_expire;