AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
ObjectGridLoader.cpp File Reference
#include "ObjectGridLoader.h"
#include "CellImpl.h"
#include "Corpse.h"
#include "Creature.h"
#include "DynamicObject.h"
#include "GameObject.h"
#include "GridNotifiers.h"
#include "ObjectMgr.h"
#include "Transport.h"
#include "Vehicle.h"

Go to the source code of this file.

Classes

class  ObjectWorldLoader
 

Functions

template<class T >
void AddObjectHelper (CellCoord &cell, GridRefMgr< T > &m, uint32 &count, Map *, T *obj)
 
template<>
void AddObjectHelper (CellCoord &cell, CreatureMapType &m, uint32 &count, Map *map, Creature *obj)
 
template<>
void AddObjectHelper (CellCoord &cell, GameObjectMapType &m, uint32 &count, Map *map, GameObject *obj)
 
template<class T >
void LoadHelper (CellGuidSet const &, CellCoord &, GridRefMgr< T > &, uint32 &, Map *)
 
template<>
void LoadHelper (CellGuidSet const &guid_set, CellCoord &cell, GridRefMgr< Creature > &m, uint32 &count, Map *map)
 
template<>
void LoadHelper (CellGuidSet const &guid_set, CellCoord &cell, GridRefMgr< GameObject > &m, uint32 &count, Map *map)
 

Function Documentation

◆ AddObjectHelper() [1/3]

template<>
void AddObjectHelper ( CellCoord cell,
CreatureMapType m,
uint32 count,
Map map,
Creature obj 
)
77{
78 obj->AddToGrid(m);
80 obj->AddToWorld();
81 if (obj->isActiveObject())
82 map->AddToActive(obj);
83
84 ++count;
85}
void AddToWorld() override
Definition: Creature.cpp:256
void AddToGrid(GridRefMgr< T > &m)
Definition: Object.h:338
bool isActiveObject() const
Definition: Object.h:560
static void SetObjectCell(T *obj, CellCoord const &cellCoord)
Definition: ObjectGridLoader.cpp:50
void AddToActive(T *obj)
Definition: Map.cpp:2756

References Map::AddToActive(), GridObject< T >::AddToGrid(), Creature::AddToWorld(), WorldObject::isActiveObject(), and ObjectGridLoader::SetObjectCell().

◆ AddObjectHelper() [2/3]

template<>
void AddObjectHelper ( CellCoord cell,
GameObjectMapType m,
uint32 count,
Map map,
GameObject obj 
)
89{
90 obj->AddToGrid(m);
92 obj->AddToWorld();
93 if (obj->isActiveObject())
94 map->AddToActive(obj);
95
96 ++count;
97}
void AddToWorld() override
Definition: GameObject.cpp:141

References Map::AddToActive(), GridObject< T >::AddToGrid(), GameObject::AddToWorld(), WorldObject::isActiveObject(), and ObjectGridLoader::SetObjectCell().

◆ AddObjectHelper() [3/3]

template<class T >
void AddObjectHelper ( CellCoord cell,
GridRefMgr< T > &  m,
uint32 count,
Map ,
T *  obj 
)
68{
69 obj->AddToGrid(m);
71 obj->AddToWorld();
72 ++count;
73}

References ObjectGridLoader::SetObjectCell().

Referenced by LoadHelper().

◆ LoadHelper() [1/3]

template<class T >
void LoadHelper ( CellGuidSet const &  ,
CellCoord ,
GridRefMgr< T > &  ,
uint32 ,
Map  
)
101{
102}

Referenced by ObjectGridLoader::Visit().

◆ LoadHelper() [2/3]

template<>
void LoadHelper ( CellGuidSet const &  guid_set,
CellCoord cell,
GridRefMgr< Creature > &  m,
uint32 count,
Map map 
)
106{
107 for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
108 {
109 Creature* obj = new Creature();
110 ObjectGuid::LowType guid = *i_guid;
111 if (!obj->LoadFromDB(guid, map))
112 {
113 delete obj;
114 continue;
115 }
116
117 AddObjectHelper(cell, m, count, map, obj);
118
120 {
122 {
123 // call MoveInLineOfSight for nearby grid creatures
124 Acore::AIRelocationNotifier notifier(*obj);
125 Cell::VisitGridObjects(obj, notifier, 60.f);
126 }
127 }
128 }
129}
@ NOTIFY_AI_RELOCATION
Definition: Object.h:63
@ NOTIFY_VISIBILITY_CHANGED
Definition: Object.h:64
@ REACT_AGGRESSIVE
Definition: Unit.h:1037
@ UNIT_STATE_SIGHTLESS
Definition: Unit.h:367
void AddObjectHelper(CellCoord &cell, GridRefMgr< T > &m, uint32 &count, Map *, T *obj)
Definition: ObjectGridLoader.cpp:67
@ IDLE_MOTION_TYPE
Definition: MotionMaster.h:37
Definition: Creature.h:46
bool HasReactState(ReactStates state) const
Definition: Creature.h:92
bool IsMoveInLineOfSightDisabled()
Definition: Creature.h:270
MovementGeneratorType GetDefaultMovementType() const override
-------—End of Pet responses methods-------—
Definition: Creature.h:87
bool LoadFromDB(ObjectGuid::LowType guid, Map *map, bool allowDuplicate=false)
Definition: Creature.h:213
bool isNeedNotify(uint16 f) const
Definition: Object.h:554
uint32 LowType
Definition: ObjectGuid.h:124
bool IsAlive() const
Definition: Unit.h:1822
bool IsImmuneToNPC() const
Definition: Unit.h:1697
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1410
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:179
Definition: GridNotifiers.h:89

References AddObjectHelper(), Creature::GetDefaultMovementType(), Creature::HasReactState(), Unit::HasUnitState(), IDLE_MOTION_TYPE, Unit::IsAlive(), Unit::IsImmuneToNPC(), Creature::IsMoveInLineOfSightDisabled(), WorldObject::isNeedNotify(), Creature::LoadFromDB(), NOTIFY_AI_RELOCATION, NOTIFY_VISIBILITY_CHANGED, REACT_AGGRESSIVE, UNIT_STATE_SIGHTLESS, and Cell::VisitGridObjects().

◆ LoadHelper() [3/3]

template<>
void LoadHelper ( CellGuidSet const &  guid_set,
CellCoord cell,
GridRefMgr< GameObject > &  m,
uint32 count,
Map map 
)
133{
134 for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
135 {
136 ObjectGuid::LowType guid = *i_guid;
137 GameObjectData const* data = sObjectMgr->GetGameObjectData(guid);
138 GameObject* obj = data && sObjectMgr->IsGameObjectStaticTransport(data->id) ? new StaticTransport() : new GameObject();
139
140 if (!obj->LoadFromDB(guid, map))
141 {
142 delete obj;
143 continue;
144 }
145
146 AddObjectHelper(cell, m, count, map, obj);
147 }
148}
#define sObjectMgr
Definition: ObjectMgr.h:1640
Definition: GameObject.h:122
bool LoadFromDB(ObjectGuid::LowType guid, Map *map)
Definition: GameObject.h:161
Definition: GameObjectData.h:697
uint32 id
Definition: GameObjectData.h:699
Definition: Transport.h:112

References AddObjectHelper(), GameObjectData::id, GameObject::LoadFromDB(), and sObjectMgr.