Update some code for 322a
--HG-- branch : trunk
This commit is contained in:
+35
-21
@@ -1932,38 +1932,52 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
|
|||||||
return summon;
|
return summon;
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature* WorldObject::FindNearestCreature(uint32 uiEntry, float fMaxSearchRange, bool bAlive)
|
Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive)
|
||||||
{
|
{
|
||||||
Creature *pCreature = NULL;
|
Creature *creature = NULL;
|
||||||
Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, uiEntry, bAlive, fMaxSearchRange);
|
Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, entry, alive, range);
|
||||||
Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(this, pCreature, checker);
|
Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(this, creature, checker);
|
||||||
VisitNearbyObject(fMaxSearchRange, searcher);
|
VisitNearbyObject(range, searcher);
|
||||||
return pCreature;
|
return creature;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameObject* WorldObject::FindNearestGameObject(uint32 uiEntry, float fMaxSearchRange)
|
GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range)
|
||||||
{
|
{
|
||||||
GameObject *pGO = NULL;
|
GameObject *go = NULL;
|
||||||
Trinity::NearestGameObjectEntryInObjectRangeCheck checker(*this, uiEntry, fMaxSearchRange);
|
Trinity::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range);
|
||||||
Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> searcher(this, pGO, checker);
|
Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> searcher(this, go, checker);
|
||||||
VisitNearbyGridObject(fMaxSearchRange, searcher);
|
VisitNearbyGridObject(range, searcher);
|
||||||
return pGO;
|
return go;
|
||||||
}
|
|
||||||
|
|
||||||
void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange)
|
|
||||||
{
|
|
||||||
Trinity::AllCreaturesOfEntryInRange check(this, uiEntry, fMaxSearchRange);
|
|
||||||
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(this, lList, check);
|
|
||||||
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher);
|
|
||||||
VisitNearbyObject(fMaxSearchRange, searcher);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange)
|
void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange)
|
||||||
{
|
{
|
||||||
|
CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY()));
|
||||||
|
Cell cell(pair);
|
||||||
|
cell.data.Part.reserved = ALL_DISTRICT;
|
||||||
|
cell.SetNoCreate();
|
||||||
|
|
||||||
Trinity::AllGameObjectsWithEntryInRange check(this, uiEntry, fMaxSearchRange);
|
Trinity::AllGameObjectsWithEntryInRange check(this, uiEntry, fMaxSearchRange);
|
||||||
Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange> searcher(this, lList, check);
|
Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange> searcher(this, lList, check);
|
||||||
TypeContainerVisitor<Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange>, GridTypeMapContainer> visitor(searcher);
|
TypeContainerVisitor<Trinity::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange>, GridTypeMapContainer> visitor(searcher);
|
||||||
VisitNearbyGridObject(fMaxSearchRange, searcher);
|
|
||||||
|
CellLock<GridReadGuard> cell_lock(cell, pair);
|
||||||
|
cell_lock->Visit(cell_lock, visitor, *(this->GetMap()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange)
|
||||||
|
{
|
||||||
|
CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY()));
|
||||||
|
Cell cell(pair);
|
||||||
|
cell.data.Part.reserved = ALL_DISTRICT;
|
||||||
|
cell.SetNoCreate();
|
||||||
|
|
||||||
|
Trinity::AllCreaturesOfEntryInRange check(this, uiEntry, fMaxSearchRange);
|
||||||
|
Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange> searcher(this, lList, check);
|
||||||
|
TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AllCreaturesOfEntryInRange>, GridTypeMapContainer> visitor(searcher);
|
||||||
|
|
||||||
|
CellLock<GridReadGuard> cell_lock(cell, pair);
|
||||||
|
cell_lock->Visit(cell_lock, visitor, *(this->GetMap()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+4
-6
@@ -237,8 +237,7 @@ class TRINITY_DLL_SPEC Object
|
|||||||
|
|
||||||
bool HasFlag( uint16 index, uint32 flag ) const
|
bool HasFlag( uint16 index, uint32 flag ) const
|
||||||
{
|
{
|
||||||
if(index >= m_valuesCount && !PrintIndexError(index , false))
|
if( index >= m_valuesCount && !PrintIndexError( index , false ) ) return false;
|
||||||
return false;
|
|
||||||
return (m_uint32Values[ index ] & flag) != 0;
|
return (m_uint32Values[ index ] & flag) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,11 +610,11 @@ class TRINITY_DLL_SPEC WorldObject : public Object, public WorldLocation
|
|||||||
GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime);
|
GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime);
|
||||||
Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = NULL);
|
Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = NULL);
|
||||||
|
|
||||||
Creature* FindNearestCreature(uint32 uiEntry, float fMaxSearchRange, bool bAlive = true);
|
Creature* FindNearestCreature(uint32 entry, float range, bool alive = true);
|
||||||
GameObject* FindNearestGameObject(uint32 uiEntry, float fMaxSearchRange);
|
GameObject* FindNearestGameObject(uint32 entry, float range);
|
||||||
|
|
||||||
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange);
|
|
||||||
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange);
|
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange);
|
||||||
|
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange);
|
||||||
|
|
||||||
void DestroyForNearbyPlayers();
|
void DestroyForNearbyPlayers();
|
||||||
|
|
||||||
@@ -655,4 +654,3 @@ class TRINITY_DLL_SPEC WorldObject : public Object, public WorldLocation
|
|||||||
uint32 m_phaseMask; // in area phase state
|
uint32 m_phaseMask; // in area phase state
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,10 @@ ObjectAccessor::ObjectAccessor() {}
|
|||||||
ObjectAccessor::~ObjectAccessor()
|
ObjectAccessor::~ObjectAccessor()
|
||||||
{
|
{
|
||||||
for (Player2CorpsesMapType::const_iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); ++itr)
|
for (Player2CorpsesMapType::const_iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); ++itr)
|
||||||
|
{
|
||||||
|
itr->second->RemoveFromWorld();
|
||||||
delete itr->second;
|
delete itr->second;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature*
|
Creature*
|
||||||
@@ -351,6 +354,10 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
|
|||||||
// remove corpse from DB
|
// remove corpse from DB
|
||||||
corpse->DeleteFromDB();
|
corpse->DeleteFromDB();
|
||||||
|
|
||||||
|
// we don't want bones to save some cpu.. :)
|
||||||
|
delete corpse;
|
||||||
|
return NULL;
|
||||||
|
|
||||||
Corpse *bones = NULL;
|
Corpse *bones = NULL;
|
||||||
// create the bones only if the map and the grid is loaded at the corpse's location
|
// create the bones only if the map and the grid is loaded at the corpse's location
|
||||||
// ignore bones creating option in case insignia
|
// ignore bones creating option in case insignia
|
||||||
@@ -521,4 +528,3 @@ template Creature* ObjectAccessor::GetObjectInWorld<Creature>(uint32 mapid, floa
|
|||||||
template Corpse* ObjectAccessor::GetObjectInWorld<Corpse>(uint32 mapid, float x, float y, uint64 guid, Corpse* /*fake*/);
|
template Corpse* ObjectAccessor::GetObjectInWorld<Corpse>(uint32 mapid, float x, float y, uint64 guid, Corpse* /*fake*/);
|
||||||
template GameObject* ObjectAccessor::GetObjectInWorld<GameObject>(uint32 mapid, float x, float y, uint64 guid, GameObject* /*fake*/);
|
template GameObject* ObjectAccessor::GetObjectInWorld<GameObject>(uint32 mapid, float x, float y, uint64 guid, GameObject* /*fake*/);
|
||||||
template DynamicObject* ObjectAccessor::GetObjectInWorld<DynamicObject>(uint32 mapid, float x, float y, uint64 guid, DynamicObject* /*fake*/);
|
template DynamicObject* ObjectAccessor::GetObjectInWorld<DynamicObject>(uint32 mapid, float x, float y, uint64 guid, DynamicObject* /*fake*/);
|
||||||
|
|
||||||
|
|||||||
@@ -267,4 +267,3 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
|
|||||||
LockType i_petGuard;
|
LockType i_petGuard;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user