[8035] Return found guardian in search function. Update caller.

This commit is contained in:
VladimirMangos 2009-06-17 19:27:02 +04:00
parent cb8cffc11e
commit 0b4c37f751
4 changed files with 7 additions and 7 deletions

View file

@ -3621,7 +3621,7 @@ void Spell::EffectSummonGuardian(uint32 i)
// FIXME: some guardians have control spell applied and controlled by player and anyway player can't summon in this time // FIXME: some guardians have control spell applied and controlled by player and anyway player can't summon in this time
// so this code hack in fact // so this code hack in fact
if( m_caster->GetTypeId() == TYPEID_PLAYER && (duration <= 0 || GetSpellRecoveryTime(m_spellInfo) == 0) ) if( m_caster->GetTypeId() == TYPEID_PLAYER && (duration <= 0 || GetSpellRecoveryTime(m_spellInfo) == 0) )
if(((Player*)m_caster)->HasGuardianWithEntry(pet_entry)) if(m_caster->FindGuardianWithEntry(pet_entry))
return; // find old guardian, ignore summon return; // find old guardian, ignore summon
// in another case summon new // in another case summon new
@ -6584,4 +6584,4 @@ void Spell::EffectRenamePet(uint32 /*eff_idx*/)
return; return;
unitTarget->SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_ALLOWED); unitTarget->SetByteValue(UNIT_FIELD_BYTES_2, 2, UNIT_RENAME_ALLOWED);
} }

View file

@ -7584,7 +7584,7 @@ void Unit::RemoveGuardians()
} }
} }
bool Unit::HasGuardianWithEntry(uint32 entry) Pet* Unit::FindGuardianWithEntry(uint32 entry)
{ {
// pet guid middle part is entry (and creature also) // pet guid middle part is entry (and creature also)
// and in guardian list must be guardians with same entry _always_ // and in guardian list must be guardians with same entry _always_
@ -7592,10 +7592,10 @@ bool Unit::HasGuardianWithEntry(uint32 entry)
{ {
if(Pet* pet = ObjectAccessor::GetPet(*itr)) if(Pet* pet = ObjectAccessor::GetPet(*itr))
if (pet->GetEntry() == entry) if (pet->GetEntry() == entry)
return true; return pet;
} }
return false; return NULL;
} }
void Unit::UnsummonAllTotems() void Unit::UnsummonAllTotems()

View file

@ -1196,7 +1196,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void AddGuardian(Pet* pet); void AddGuardian(Pet* pet);
void RemoveGuardian(Pet* pet); void RemoveGuardian(Pet* pet);
void RemoveGuardians(); void RemoveGuardians();
bool HasGuardianWithEntry(uint32 entry); Pet* FindGuardianWithEntry(uint32 entry);
bool isCharmed() const { return GetCharmerGUID() != 0; } bool isCharmed() const { return GetCharmerGUID() != 0; }

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 "8034" #define REVISION_NR "8035"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__