[11456] Some ObejctGuid uses in Pet code.

This commit is contained in:
VladimirMangos 2011-05-09 20:20:31 +04:00
parent 51031c2d24
commit 7318bb0864
4 changed files with 21 additions and 19 deletions

View file

@ -1281,7 +1281,7 @@ void Pet::_LoadAuras(uint32 timediff)
do do
{ {
Field *fields = result->Fetch(); Field *fields = result->Fetch();
uint64 caster_guid = fields[0].GetUInt64(); ObjectGuid casterGuid = ObjectGuid(fields[0].GetUInt64());
uint32 item_lowguid = fields[1].GetUInt32(); uint32 item_lowguid = fields[1].GetUInt32();
uint32 spellid = fields[2].GetUInt32(); uint32 spellid = fields[2].GetUInt32();
uint32 stackcount = fields[3].GetUInt32(); uint32 stackcount = fields[3].GetUInt32();
@ -1307,7 +1307,7 @@ void Pet::_LoadAuras(uint32 timediff)
} }
// do not load single target auras (unless they were cast by the player) // do not load single target auras (unless they were cast by the player)
if (caster_guid != GetGUID() && IsSingleTargetSpell(spellproto)) if (casterGuid != GetObjectGuid() && IsSingleTargetSpell(spellproto))
continue; continue;
if (remaintime != -1 && !IsPositiveSpell(spellproto)) if (remaintime != -1 && !IsPositiveSpell(spellproto))
@ -1336,7 +1336,7 @@ void Pet::_LoadAuras(uint32 timediff)
stackcount = 1; stackcount = 1;
SpellAuraHolder *holder = CreateSpellAuraHolder(spellproto, this, NULL); SpellAuraHolder *holder = CreateSpellAuraHolder(spellproto, this, NULL);
holder->SetLoadedState(caster_guid, ObjectGuid(HIGHGUID_ITEM, item_lowguid), stackcount, remaincharges, maxduration, remaintime); holder->SetLoadedState(casterGuid, ObjectGuid(HIGHGUID_ITEM, item_lowguid), stackcount, remaincharges, maxduration, remaintime);
for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{ {

View file

@ -250,7 +250,7 @@ void PetAI::UpdateAI(const uint32 diff)
else else
{ {
bool spellUsed = false; bool spellUsed = false;
for(std::set<uint64>::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) for (AllySet::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar)
{ {
Unit* Target = ObjectAccessor::GetUnit(*m_creature,*tar); Unit* Target = ObjectAccessor::GetUnit(*m_creature,*tar);
@ -330,7 +330,7 @@ void PetAI::UpdateAllies()
return; return;
m_AllySet.clear(); m_AllySet.clear();
m_AllySet.insert(m_creature->GetGUID()); m_AllySet.insert(m_creature->GetObjectGuid());
if (pGroup) //add group if (pGroup) //add group
{ {
for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
@ -342,11 +342,11 @@ void PetAI::UpdateAllies()
if (Target->GetGUID() == owner->GetGUID()) if (Target->GetGUID() == owner->GetGUID())
continue; continue;
m_AllySet.insert(Target->GetGUID()); m_AllySet.insert(Target->GetObjectGuid());
} }
} }
else //remove group else //remove group
m_AllySet.insert(owner->GetGUID()); m_AllySet.insert(owner->GetObjectGuid());
} }
void PetAI::AttackedBy(Unit *attacker) void PetAI::AttackedBy(Unit *attacker)

View file

@ -49,7 +49,9 @@ class MANGOS_DLL_DECL PetAI : public CreatureAI
TimeTracker i_tracker; TimeTracker i_tracker;
bool inCombat; bool inCombat;
std::set<uint64> m_AllySet;
typedef std::set<ObjectGuid> AllySet;
AllySet m_AllySet;
uint32 m_updateAlliesTimer; uint32 m_updateAlliesTimer;
}; };
#endif #endif

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 "11455" #define REVISION_NR "11456"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__