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"

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 
)
76{
77 obj->AddToGrid(m);
79 obj->AddToWorld();
80 if (obj->isActiveObject())
81 map->AddToActive(obj);
82
83 ++count;
84}
void AddToWorld() override
Definition: Creature.cpp:311
void AddToGrid(GridRefMgr< T > &m)
Definition: Object.h:350
bool isActiveObject() const
Definition: Object.h:574
static void SetObjectCell(T *obj, CellCoord const &cellCoord)
Definition: ObjectGridLoader.cpp:49
void AddToActive(T *obj)
Definition: Map.cpp:2761

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 
)
88{
89 obj->AddToGrid(m);
91 obj->AddToWorld();
92 if (obj->isActiveObject())
93 map->AddToActive(obj);
94
95 ++count;
96}
void AddToWorld() override
Definition: GameObject.cpp:140

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 
)
67{
68 obj->AddToGrid(m);
70 obj->AddToWorld();
71 ++count;
72}

References ObjectGridLoader::SetObjectCell().

Referenced by LoadHelper().

◆ LoadHelper() [1/3]

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

Referenced by ObjectGridLoader::Visit().

◆ LoadHelper() [2/3]

template<>
void LoadHelper ( CellGuidSet const &  guid_set,
CellCoord cell,
GridRefMgr< Creature > &  m,
uint32 count,
Map map 
)
105{
106 for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
107 {
108 Creature* obj = new Creature();
109 ObjectGuid::LowType guid = *i_guid;
110 if (!obj->LoadFromDB(guid, map))
111 {
112 delete obj;
113 continue;
114 }
115
116 AddObjectHelper(cell, m, count, map, obj);
117
119 {
121 {
122 // call MoveInLineOfSight for nearby grid creatures
123 Acore::AIRelocationNotifier notifier(*obj);
124 Cell::VisitGridObjects(obj, notifier, 60.f);
125 }
126 }
127 }
128}
void AddObjectHelper(CellCoord &cell, GridRefMgr< T > &m, uint32 &count, Map *, T *obj)
Definition: ObjectGridLoader.cpp:66
@ REACT_AGGRESSIVE
Definition: Unit.h:550
@ UNIT_STATE_SIGHTLESS
Definition: UnitDefines.h:192
@ NOTIFY_AI_RELOCATION
Definition: Object.h:66
@ NOTIFY_VISIBILITY_CHANGED
Definition: Object.h:67
@ IDLE_MOTION_TYPE
Definition: MotionMaster.h:37
Definition: Creature.h:46
bool HasReactState(ReactStates state) const
Definition: Creature.h:99
bool IsMoveInLineOfSightDisabled()
Definition: Creature.h:279
MovementGeneratorType GetDefaultMovementType() const override
-------—End of Pet responses methods-------—
Definition: Creature.h:88
bool LoadFromDB(ObjectGuid::LowType guid, Map *map, bool allowDuplicate=false)
Definition: Creature.h:222
bool isNeedNotify(uint16 f) const
Definition: Object.h:568
uint32 LowType
Definition: ObjectGuid.h:122
bool IsAlive() const
Definition: Unit.h:1216
bool IsImmuneToNPC() const
Definition: Unit.h:815
bool HasUnitState(const uint32 f) const
Definition: Unit.h:673
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:178
Definition: GridNotifiers.h:91

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 
)
132{
133 for (CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
134 {
135 ObjectGuid::LowType guid = *i_guid;
136 GameObjectData const* data = sObjectMgr->GetGameObjectData(guid);
137 GameObject* obj = data && sObjectMgr->IsGameObjectStaticTransport(data->id) ? new StaticTransport() : new GameObject();
138
139 if (!obj->LoadFromDB(guid, map))
140 {
141 delete obj;
142 continue;
143 }
144
145 AddObjectHelper(cell, m, count, map, obj);
146 }
147}
#define sObjectMgr
Definition: ObjectMgr.h:1633
Definition: GameObject.h:121
bool LoadFromDB(ObjectGuid::LowType guid, Map *map)
Definition: GameObject.h:160
Definition: GameObjectData.h:696
uint32 id
Definition: GameObjectData.h:698
Definition: Transport.h:112

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