mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 10:05:32 +01:00
[8103] More wide use IsInWorld checks and delayed at teleport operations. Author: Ambal
* IsInWorld used to prevent return unexpected not in world objects.
* Delayed operations need to process its in world state.
--HG--
branch : trunk
This commit is contained in:
@@ -60,7 +60,7 @@ ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const &u, uint64 guid)
|
||||
if(IS_VEHICLE_GUID(guid))
|
||||
return GetVehicle(guid);
|
||||
|
||||
return u.GetMap()->GetCreature(guid);
|
||||
return u.IsInWorld() ? u.GetMap()->GetCreature(guid) : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -135,7 +135,11 @@ Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, u
|
||||
Player*
|
||||
ObjectAccessor::FindPlayer(uint64 guid)
|
||||
{
|
||||
return GetObjectInWorld(guid, (Player*)NULL);
|
||||
Player * plr = GetObjectInWorld(guid, (Player*)NULL);
|
||||
if(!plr || !plr->IsInWorld())
|
||||
return NULL;
|
||||
|
||||
return plr;
|
||||
}
|
||||
|
||||
Player*
|
||||
@@ -145,7 +149,7 @@ ObjectAccessor::FindPlayerByName(const char *name)
|
||||
HashMapHolder<Player>::MapType& m = HashMapHolder<Player>::GetContainer();
|
||||
HashMapHolder<Player>::MapType::iterator iter = m.begin();
|
||||
for(; iter != m.end(); ++iter)
|
||||
if( ::strcmp(name, iter->second->GetName()) == 0 )
|
||||
if(iter->second->IsInWorld() && ( ::strcmp(name, iter->second->GetName()) == 0 ))
|
||||
return iter->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user