*Thread safe player searcher in scripts.

--HG--
branch : trunk
This commit is contained in:
QAston
2010-07-30 15:51:07 +02:00
parent 9bda35c7df
commit d666ba26c1
32 changed files with 69 additions and 66 deletions
@@ -309,7 +309,7 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const
Player* FollowerAI::GetLeaderForFollower()
{
if (Player* pLeader = Unit::GetPlayer(m_uiLeaderGUID))
if (Player* pLeader = Unit::GetPlayer(*me, m_uiLeaderGUID))
{
if (pLeader->isAlive())
return pLeader;
+2 -2
View File
@@ -12851,9 +12851,9 @@ Unit* Unit::GetUnit(WorldObject& object, uint64 guid)
return ObjectAccessor::GetUnit(object,guid);
}
Player* Unit::GetPlayer(uint64 guid)
Player* Unit::GetPlayer(WorldObject& object, uint64 guid)
{
return ObjectAccessor::FindPlayer(guid);
return ObjectAccessor::GetPlayer(object,guid);
}
Creature* Unit::GetCreature(WorldObject& object, uint64 guid)
+1 -1
View File
@@ -1868,7 +1868,7 @@ class Unit : public WorldObject
void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
void removeFollower(FollowerReference* /*pRef*/) { /* nothing to do yet */ }
static Unit* GetUnit(WorldObject& object, uint64 guid);
static Player* GetPlayer(uint64 guid);
static Player* GetPlayer(WorldObject& object, uint64 guid);
static Creature* GetCreature(WorldObject& object, uint64 guid);
MotionMaster* GetMotionMaster(){ return &i_motionMaster; }
@@ -1651,6 +1651,9 @@ void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit * caster)
DynObjAura::DynObjAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID)
: Aura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID)
{
ASSERT(GetDynobjOwner());
ASSERT(GetDynobjOwner()->IsInWorld());
ASSERT(GetDynobjOwner()->GetMap() == caster->GetMap());
GetDynobjOwner()->SetAura(this);
}
+1 -1
View File
@@ -351,7 +351,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
uint8 count = 0;
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if (ihit->targetGUID != m_caster->GetGUID())
if (Player *target = ObjectAccessor::FindPlayer(ihit->targetGUID))
if (Player *target = ObjectAccessor::GetPlayer(*m_caster, ihit->targetGUID))
if (target->HasAura(m_triggeredByAuraSpell->Id))
++count;
if (count)