cleanup into grid containers
grid containers doesn't contains guid keys, so guid parameter is useless, removed find functions(anyway result of search would be null always) --HG-- branch : trunk
This commit is contained in:
@@ -60,25 +60,20 @@ class TRINITY_DLL_DECL Grid
|
|||||||
|
|
||||||
/** an object of interested enters the grid
|
/** an object of interested enters the grid
|
||||||
*/
|
*/
|
||||||
template<class SPECIFIC_OBJECT> void AddWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_OBJECT> void AddWorldObject(SPECIFIC_OBJECT *obj)
|
||||||
{
|
{
|
||||||
if(!i_objects.template insert<SPECIFIC_OBJECT>(hdl, obj))
|
if(!i_objects.template insert<SPECIFIC_OBJECT>(obj))
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** an object of interested exits the grid
|
/** an object of interested exits the grid
|
||||||
*/
|
*/
|
||||||
template<class SPECIFIC_OBJECT> void RemoveWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_OBJECT> void RemoveWorldObject(SPECIFIC_OBJECT *obj)
|
||||||
{
|
{
|
||||||
if(!i_objects.template remove<SPECIFIC_OBJECT>(obj, hdl))
|
if(!i_objects.template remove<SPECIFIC_OBJECT>(obj))
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Accessors: Returns a specific type of object in the WORDL_OBJECT_TYPES
|
|
||||||
*/
|
|
||||||
template<class SPECIFIC_OBJECT> const SPECIFIC_OBJECT* GetWorldObject(OBJECT_HANDLE hdl, SPECIFIC_OBJECT* fake) const { return i_objects.template find<SPECIFIC_OBJECT>(hdl); }
|
|
||||||
template<class SPECIFIC_OBJECT> SPECIFIC_OBJECT* GetWorldObject(OBJECT_HANDLE hdl, SPECIFIC_OBJECT *fake) { return i_objects.template find<SPECIFIC_OBJECT>(hdl, fake); }
|
|
||||||
|
|
||||||
/** Refreshes/update the grid. This required for remote grids.
|
/** Refreshes/update the grid. This required for remote grids.
|
||||||
*/
|
*/
|
||||||
void RefreshGrid(void) { /* TBI */}
|
void RefreshGrid(void) { /* TBI */}
|
||||||
@@ -109,24 +104,19 @@ class TRINITY_DLL_DECL Grid
|
|||||||
*/
|
*/
|
||||||
unsigned int ActiveObjectsInGrid(void) const { return /*m_activeGridObjects.size()+*/i_objects.template Count<ACTIVE_OBJECT>(); }
|
unsigned int ActiveObjectsInGrid(void) const { return /*m_activeGridObjects.size()+*/i_objects.template Count<ACTIVE_OBJECT>(); }
|
||||||
|
|
||||||
/** Accessors: Returns a specific type of object in the GRID_OBJECT_TYPES
|
|
||||||
*/
|
|
||||||
template<class SPECIFIC_OBJECT> const SPECIFIC_OBJECT* GetGridObject(OBJECT_HANDLE hdl, SPECIFIC_OBJECT *fake) const { return i_container.template find<SPECIFIC_OBJECT>(hdl, fake); }
|
|
||||||
template<class SPECIFIC_OBJECT> SPECIFIC_OBJECT* GetGridObject(OBJECT_HANDLE hdl, SPECIFIC_OBJECT *fake) { return i_container.template find<SPECIFIC_OBJECT>(hdl, fake); }
|
|
||||||
|
|
||||||
/** Inserts a container type object into the grid.
|
/** Inserts a container type object into the grid.
|
||||||
*/
|
*/
|
||||||
template<class SPECIFIC_OBJECT> void AddGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_OBJECT> void AddGridObject(SPECIFIC_OBJECT *obj)
|
||||||
{
|
{
|
||||||
if(!i_container.template insert<SPECIFIC_OBJECT>(hdl, obj))
|
if(!i_container.template insert<SPECIFIC_OBJECT>(obj))
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Removes a containter type object from the grid
|
/** Removes a containter type object from the grid
|
||||||
*/
|
*/
|
||||||
template<class SPECIFIC_OBJECT> void RemoveGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_OBJECT> void RemoveGridObject(SPECIFIC_OBJECT *obj)
|
||||||
{
|
{
|
||||||
if(!i_container.template remove<SPECIFIC_OBJECT>(obj, hdl))
|
if(!i_container.template remove<SPECIFIC_OBJECT>(obj))
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,14 +119,14 @@ class TRINITY_DLL_DECL NGrid
|
|||||||
void ResetTimeTracker(time_t interval) { i_GridInfo.ResetTimeTracker(interval); }
|
void ResetTimeTracker(time_t interval) { i_GridInfo.ResetTimeTracker(interval); }
|
||||||
void UpdateTimeTracker(time_t diff) { i_GridInfo.UpdateTimeTracker(diff); }
|
void UpdateTimeTracker(time_t diff) { i_GridInfo.UpdateTimeTracker(diff); }
|
||||||
|
|
||||||
template<class SPECIFIC_OBJECT> void AddWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_OBJECT> void AddWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj)
|
||||||
{
|
{
|
||||||
getGridType(x, y).AddWorldObject(obj, hdl);
|
getGridType(x, y).AddWorldObject(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SPECIFIC_OBJECT> void RemoveWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_OBJECT> void RemoveWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj)
|
||||||
{
|
{
|
||||||
getGridType(x, y).RemoveWorldObject(obj, hdl);
|
getGridType(x, y).RemoveWorldObject(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class TT> void Visit(TypeContainerVisitor<T, TypeMapContainer<TT> > &visitor)
|
template<class T, class TT> void Visit(TypeContainerVisitor<T, TypeMapContainer<TT> > &visitor)
|
||||||
@@ -150,24 +150,14 @@ class TRINITY_DLL_DECL NGrid
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SPECIFIC_OBJECT> const SPECIFIC_OBJECT* GetGridObject(const uint32 x, const uint32 y, OBJECT_HANDLE hdl) const
|
template<class SPECIFIC_OBJECT> bool AddGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj)
|
||||||
{
|
{
|
||||||
return getGridType(x, y).template GetGridObject<SPECIFIC_OBJECT>(hdl);
|
return getGridType(x, y).AddGridObject(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SPECIFIC_OBJECT> SPECIFIC_OBJECT* GetGridObject(const uint32 x, const uint32 y, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_OBJECT> bool RemoveGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj)
|
||||||
{
|
{
|
||||||
return getGridType(x, y).template GetGridObject<SPECIFIC_OBJECT>(hdl);
|
return getGridType(x, y).RemoveGridObject(obj);
|
||||||
}
|
|
||||||
|
|
||||||
template<class SPECIFIC_OBJECT> bool AddGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
|
||||||
{
|
|
||||||
return getGridType(x, y).AddGridObject(hdl, obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class SPECIFIC_OBJECT> bool RemoveGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
|
||||||
{
|
|
||||||
return getGridType(x, y).RemoveGridObject(obj, hdl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -102,22 +102,17 @@ class TRINITY_DLL_DECL TypeMapContainer
|
|||||||
public:
|
public:
|
||||||
template<class SPECIFIC_TYPE> size_t Count() const { return Trinity::Count(i_elements, (SPECIFIC_TYPE*)NULL); }
|
template<class SPECIFIC_TYPE> size_t Count() const { return Trinity::Count(i_elements, (SPECIFIC_TYPE*)NULL); }
|
||||||
|
|
||||||
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* find(OBJECT_HANDLE hdl, SPECIFIC_TYPE *fake) { return Trinity::Find(i_elements, hdl,fake); }
|
|
||||||
|
|
||||||
/// find a specific type of object in the container
|
|
||||||
template<class SPECIFIC_TYPE> const SPECIFIC_TYPE* find(OBJECT_HANDLE hdl, SPECIFIC_TYPE *fake) const { return Trinity::Find(i_elements, hdl,fake); }
|
|
||||||
|
|
||||||
/// inserts a specific object into the container
|
/// inserts a specific object into the container
|
||||||
template<class SPECIFIC_TYPE> bool insert(OBJECT_HANDLE hdl, SPECIFIC_TYPE *obj)
|
template<class SPECIFIC_TYPE> bool insert(SPECIFIC_TYPE *obj)
|
||||||
{
|
{
|
||||||
SPECIFIC_TYPE* t = Trinity::Insert(i_elements, obj, hdl);
|
SPECIFIC_TYPE* t = Trinity::Insert(i_elements, obj);
|
||||||
return (t != NULL);
|
return (t != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes the object from the container, and returns the removed object
|
/// Removes the object from the container, and returns the removed object
|
||||||
template<class SPECIFIC_TYPE> bool remove(SPECIFIC_TYPE* obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_TYPE> bool remove(SPECIFIC_TYPE* obj)
|
||||||
{
|
{
|
||||||
SPECIFIC_TYPE* t = Trinity::Remove(i_elements, obj, hdl);
|
SPECIFIC_TYPE* t = Trinity::Remove(i_elements, obj);
|
||||||
return (t != NULL);
|
return (t != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,114 +60,55 @@ namespace Trinity
|
|||||||
return Count(elements._TailElements, fake);
|
return Count(elements._TailElements, fake);
|
||||||
}
|
}
|
||||||
|
|
||||||
// non-const find functions
|
|
||||||
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Find(ContainerMapList<SPECIFIC_TYPE> &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/)
|
|
||||||
{
|
|
||||||
//typename std::map<OBJECT_HANDLE, SPECIFIC_TYPE *>::iterator iter = elements._element.find(hdl);
|
|
||||||
//return (iter == elements._element.end() ? NULL : iter->second);
|
|
||||||
return NULL;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Find(ContainerMapList<TypeNull> &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/)
|
|
||||||
{
|
|
||||||
return NULL; // terminate recursion
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Find(ContainerMapList<T> &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/)
|
|
||||||
{
|
|
||||||
return NULL; // this is a missed
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class SPECIFIC_TYPE, class H, class T> SPECIFIC_TYPE* Find(ContainerMapList<TypeList<H, T> >&/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/)
|
|
||||||
{
|
|
||||||
//SPECIFIC_TYPE* t = Find(elements._elements, hdl,fake);
|
|
||||||
//return (t != NULL ? t :Find(elements._TailElements, hdl,fake));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// const find functions
|
|
||||||
template<class SPECIFIC_TYPE> const SPECIFIC_TYPE* Find(const ContainerMapList<SPECIFIC_TYPE> &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/)
|
|
||||||
{
|
|
||||||
//typename SPECIFIC_TYPE::iterator iter = elements._element.find(hdl);
|
|
||||||
//return (iter == elements._element.end() ? NULL : iter->second);
|
|
||||||
return NULL;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class SPECIFIC_TYPE> const SPECIFIC_TYPE* Find(const ContainerMapList<TypeNull> &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class SPECIFIC_TYPE, class T> const SPECIFIC_TYPE* Find(const ContainerMapList<T> &/*elements*/, OBJECT_HANDLE /*hdl*/, SPECIFIC_TYPE* /*fake*/)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class SPECIFIC_TYPE, class H, class T> SPECIFIC_TYPE* Find(const ContainerMapList<TypeList<H, T> >&elements, OBJECT_HANDLE hdl, SPECIFIC_TYPE* fake)
|
|
||||||
{
|
|
||||||
SPECIFIC_TYPE* t = Find(elements._elements, hdl,fake);
|
|
||||||
if( t)
|
|
||||||
return t;
|
|
||||||
|
|
||||||
return Find(elements._TailElement, hdl,fake);
|
|
||||||
}
|
|
||||||
|
|
||||||
// non-const insert functions
|
// non-const insert functions
|
||||||
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<SPECIFIC_TYPE> &elements, SPECIFIC_TYPE *obj, OBJECT_HANDLE /*hdl*/)
|
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<SPECIFIC_TYPE> &elements, SPECIFIC_TYPE *obj)
|
||||||
{
|
{
|
||||||
//elements._element[hdl] = obj;
|
//elements._element[hdl] = obj;
|
||||||
obj->GetGridRef().link(&elements._element, obj);
|
obj->GetGridRef().link(&elements._element, obj);
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/, OBJECT_HANDLE /*hdl*/)
|
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Insert(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is a missed
|
// this is a missed
|
||||||
template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Insert(ContainerMapList<T> &/*elements*/, SPECIFIC_TYPE * /*obj*/, OBJECT_HANDLE /*hdl*/)
|
template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Insert(ContainerMapList<T> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
|
||||||
{
|
{
|
||||||
return NULL; // a missed
|
return NULL; // a missed
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursion
|
// Recursion
|
||||||
template<class SPECIFIC_TYPE, class H, class T> SPECIFIC_TYPE* Insert(ContainerMapList<TypeList<H, T> >&elements, SPECIFIC_TYPE *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_TYPE, class H, class T> SPECIFIC_TYPE* Insert(ContainerMapList<TypeList<H, T> >&elements, SPECIFIC_TYPE *obj)
|
||||||
{
|
{
|
||||||
SPECIFIC_TYPE* t= Insert(elements._elements, obj, hdl);
|
SPECIFIC_TYPE* t= Insert(elements._elements, obj);
|
||||||
return (t != NULL ? t : Insert(elements._TailElements, obj, hdl));
|
return (t != NULL ? t : Insert(elements._TailElements, obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
// non-const remove method
|
// non-const remove method
|
||||||
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<SPECIFIC_TYPE> & /*elements*/, SPECIFIC_TYPE *obj, OBJECT_HANDLE /*hdl*/)
|
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<SPECIFIC_TYPE> & /*elements*/, SPECIFIC_TYPE *obj)
|
||||||
{
|
{
|
||||||
/*typename std::map<OBJECT_HANDLE, SPECIFIC_TYPE *>::iterator iter = elements._element.find(hdl);
|
|
||||||
if( iter != elements._element.end() )
|
|
||||||
{
|
|
||||||
SPECIFIC_TYPE* t = iter->second;
|
|
||||||
elements._element.erase(iter);
|
|
||||||
return t;
|
|
||||||
}*/
|
|
||||||
obj->GetGridRef().unlink();
|
obj->GetGridRef().unlink();
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/, OBJECT_HANDLE /*hdl*/)
|
template<class SPECIFIC_TYPE> SPECIFIC_TYPE* Remove(ContainerMapList<TypeNull> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is a missed
|
// this is a missed
|
||||||
template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Remove(ContainerMapList<T> &/*elements*/, SPECIFIC_TYPE * /*obj*/, OBJECT_HANDLE /*hdl*/)
|
template<class SPECIFIC_TYPE, class T> SPECIFIC_TYPE* Remove(ContainerMapList<T> &/*elements*/, SPECIFIC_TYPE * /*obj*/)
|
||||||
{
|
{
|
||||||
return NULL; // a missed
|
return NULL; // a missed
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class SPECIFIC_TYPE, class T, class H> SPECIFIC_TYPE* Remove(ContainerMapList<TypeList<H, T> > &elements, SPECIFIC_TYPE *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_TYPE, class T, class H> SPECIFIC_TYPE* Remove(ContainerMapList<TypeList<H, T> > &elements, SPECIFIC_TYPE *obj)
|
||||||
{
|
{
|
||||||
// The head element is bad
|
// The head element is bad
|
||||||
SPECIFIC_TYPE* t = Remove(elements._elements, obj, hdl);
|
SPECIFIC_TYPE* t = Remove(elements._elements, obj);
|
||||||
return ( t != NULL ? t : Remove(elements._TailElements, obj, hdl) );
|
return ( t != NULL ? t : Remove(elements._TailElements, obj) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,33 +180,6 @@ namespace Trinity
|
|||||||
void Visit(CreatureMapType &);
|
void Visit(CreatureMapType &);
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class T>
|
|
||||||
struct TRINITY_DLL_DECL ObjectAccessorNotifier
|
|
||||||
{
|
|
||||||
T *& i_object;
|
|
||||||
|
|
||||||
uint64 i_id;
|
|
||||||
ObjectAccessorNotifier(T * &obj, uint64 id) : i_object(obj), i_id(id)
|
|
||||||
{
|
|
||||||
i_object = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Visit(GridRefManager<T> &m )
|
|
||||||
{
|
|
||||||
if( i_object == NULL )
|
|
||||||
{
|
|
||||||
GridRefManager<T> *iter = m.find(i_id);
|
|
||||||
if( iter != m.end() )
|
|
||||||
{
|
|
||||||
assert( iter->second != NULL );
|
|
||||||
i_object = iter->second;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
// SEARCHERS & LIST SEARCHERS & WORKERS
|
// SEARCHERS & LIST SEARCHERS & WORKERS
|
||||||
|
|
||||||
// WorldObject searchers & workers
|
// WorldObject searchers & workers
|
||||||
|
|||||||
+10
-10
@@ -249,18 +249,18 @@ template<class T>
|
|||||||
void Map::AddToGrid(T* obj, NGridType *grid, Cell const& cell)
|
void Map::AddToGrid(T* obj, NGridType *grid, Cell const& cell)
|
||||||
{
|
{
|
||||||
if(obj->m_isWorldObject)
|
if(obj->m_isWorldObject)
|
||||||
(*grid)(cell.CellX(), cell.CellY()).template AddWorldObject<T>(obj, obj->GetGUID());
|
(*grid)(cell.CellX(), cell.CellY()).template AddWorldObject<T>(obj);
|
||||||
else
|
else
|
||||||
(*grid)(cell.CellX(), cell.CellY()).template AddGridObject<T>(obj, obj->GetGUID());
|
(*grid)(cell.CellX(), cell.CellY()).template AddGridObject<T>(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell)
|
void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell)
|
||||||
{
|
{
|
||||||
if(obj->m_isWorldObject)
|
if(obj->m_isWorldObject)
|
||||||
(*grid)(cell.CellX(), cell.CellY()).AddWorldObject(obj, obj->GetGUID());
|
(*grid)(cell.CellX(), cell.CellY()).AddWorldObject(obj);
|
||||||
else
|
else
|
||||||
(*grid)(cell.CellX(), cell.CellY()).AddGridObject(obj, obj->GetGUID());
|
(*grid)(cell.CellX(), cell.CellY()).AddGridObject(obj);
|
||||||
|
|
||||||
obj->SetCurrentCell(cell);
|
obj->SetCurrentCell(cell);
|
||||||
}
|
}
|
||||||
@@ -269,9 +269,9 @@ template<class T>
|
|||||||
void Map::RemoveFromGrid(T* obj, NGridType *grid, Cell const& cell)
|
void Map::RemoveFromGrid(T* obj, NGridType *grid, Cell const& cell)
|
||||||
{
|
{
|
||||||
if(obj->m_isWorldObject)
|
if(obj->m_isWorldObject)
|
||||||
(*grid)(cell.CellX(), cell.CellY()).template RemoveWorldObject<T>(obj, obj->GetGUID());
|
(*grid)(cell.CellX(), cell.CellY()).template RemoveWorldObject<T>(obj);
|
||||||
else
|
else
|
||||||
(*grid)(cell.CellX(), cell.CellY()).template RemoveGridObject<T>(obj, obj->GetGUID());
|
(*grid)(cell.CellX(), cell.CellY()).template RemoveGridObject<T>(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
@@ -296,8 +296,8 @@ void Map::SwitchGridContainers(T* obj, bool on)
|
|||||||
|
|
||||||
if(on)
|
if(on)
|
||||||
{
|
{
|
||||||
grid.RemoveGridObject<T>(obj, obj->GetGUID());
|
grid.RemoveGridObject<T>(obj);
|
||||||
grid.AddWorldObject<T>(obj, obj->GetGUID());
|
grid.AddWorldObject<T>(obj);
|
||||||
/*if(!grid.RemoveGridObject<T>(obj, obj->GetGUID())
|
/*if(!grid.RemoveGridObject<T>(obj, obj->GetGUID())
|
||||||
|| !grid.AddWorldObject<T>(obj, obj->GetGUID()))
|
|| !grid.AddWorldObject<T>(obj, obj->GetGUID()))
|
||||||
{
|
{
|
||||||
@@ -306,8 +306,8 @@ void Map::SwitchGridContainers(T* obj, bool on)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grid.RemoveWorldObject<T>(obj, obj->GetGUID());
|
grid.RemoveWorldObject<T>(obj);
|
||||||
grid.AddGridObject<T>(obj, obj->GetGUID());
|
grid.AddGridObject<T>(obj);
|
||||||
/*if(!grid.RemoveWorldObject<T>(obj, obj->GetGUID())
|
/*if(!grid.RemoveWorldObject<T>(obj, obj->GetGUID())
|
||||||
|| !grid.AddGridObject<T>(obj, obj->GetGUID()))
|
|| !grid.AddGridObject<T>(obj, obj->GetGUID()))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -314,12 +314,12 @@ ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair,GridType& grid,Map* ma
|
|||||||
{
|
{
|
||||||
if (iter->second->GetInstanceId() == map->GetInstanceId())
|
if (iter->second->GetInstanceId() == map->GetInstanceId())
|
||||||
{
|
{
|
||||||
grid.AddWorldObject(iter->second, iter->second->GetGUID());
|
grid.AddWorldObject(iter->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
grid.AddWorldObject(iter->second, iter->second->GetGUID());
|
grid.AddWorldObject(iter->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user