mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-05 16:39:08 +01:00
Update some code for 322a
--HG-- branch : trunk
This commit is contained in:
@@ -1932,38 +1932,52 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
|
||||
return summon;
|
||||
}
|
||||
|
||||
Creature* WorldObject::FindNearestCreature(uint32 uiEntry, float fMaxSearchRange, bool bAlive)
|
||||
Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive)
|
||||
{
|
||||
Creature *pCreature = NULL;
|
||||
Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, uiEntry, bAlive, fMaxSearchRange);
|
||||
Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(this, pCreature, checker);
|
||||
VisitNearbyObject(fMaxSearchRange, searcher);
|
||||
return pCreature;
|
||||
Creature *creature = NULL;
|
||||
Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, entry, alive, range);
|
||||
Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(this, creature, checker);
|
||||
VisitNearbyObject(range, searcher);
|
||||
return creature;
|
||||
}
|
||||
|
||||
GameObject* WorldObject::FindNearestGameObject(uint32 uiEntry, float fMaxSearchRange)
|
||||
GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range)
|
||||
{
|
||||
GameObject *pGO = NULL;
|
||||
Trinity::NearestGameObjectEntryInObjectRangeCheck checker(*this, uiEntry, fMaxSearchRange);
|
||||
Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> searcher(this, pGO, checker);
|
||||
VisitNearbyGridObject(fMaxSearchRange, searcher);
|
||||
return pGO;
|
||||
}
|
||||
|
||||
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);
|
||||
GameObject *go = NULL;
|
||||
Trinity::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range);
|
||||
Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> searcher(this, go, checker);
|
||||
VisitNearbyGridObject(range, searcher);
|
||||
return go;
|
||||
}
|
||||
|
||||
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::GameObjectListSearcher<Trinity::AllGameObjectsWithEntryInRange> searcher(this, lList, check);
|
||||
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()));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -237,8 +237,7 @@ class TRINITY_DLL_SPEC Object
|
||||
|
||||
bool HasFlag( uint16 index, uint32 flag ) const
|
||||
{
|
||||
if(index >= m_valuesCount && !PrintIndexError(index , false))
|
||||
return false;
|
||||
if( index >= m_valuesCount && !PrintIndexError( index , false ) ) return false;
|
||||
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);
|
||||
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);
|
||||
GameObject* FindNearestGameObject(uint32 uiEntry, float fMaxSearchRange);
|
||||
Creature* FindNearestCreature(uint32 entry, float range, bool alive = true);
|
||||
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 GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange);
|
||||
|
||||
void DestroyForNearbyPlayers();
|
||||
|
||||
@@ -655,4 +654,3 @@ class TRINITY_DLL_SPEC WorldObject : public Object, public WorldLocation
|
||||
uint32 m_phaseMask; // in area phase state
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -49,7 +49,10 @@ ObjectAccessor::ObjectAccessor() {}
|
||||
ObjectAccessor::~ObjectAccessor()
|
||||
{
|
||||
for (Player2CorpsesMapType::const_iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); ++itr)
|
||||
{
|
||||
itr->second->RemoveFromWorld();
|
||||
delete itr->second;
|
||||
}
|
||||
}
|
||||
|
||||
Creature*
|
||||
@@ -351,6 +354,10 @@ ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
|
||||
// remove corpse from DB
|
||||
corpse->DeleteFromDB();
|
||||
|
||||
// we don't want bones to save some cpu.. :)
|
||||
delete corpse;
|
||||
return NULL;
|
||||
|
||||
Corpse *bones = NULL;
|
||||
// create the bones only if the map and the grid is loaded at the corpse's location
|
||||
// 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 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*/);
|
||||
|
||||
|
||||
@@ -267,4 +267,3 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
|
||||
LockType i_petGuard;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user