Add some ASSERT in add/remove obj to/from grid.
This commit is contained in:
@@ -58,16 +58,19 @@ class Grid
|
||||
*/
|
||||
template<class SPECIFIC_OBJECT> void AddWorldObject(SPECIFIC_OBJECT *obj)
|
||||
{
|
||||
if (!i_objects.template insert<SPECIFIC_OBJECT>(obj))
|
||||
ASSERT(false);
|
||||
ASSERT(!obj->GetGridRef().isValid());
|
||||
i_objects.template insert<SPECIFIC_OBJECT>(obj);
|
||||
ASSERT(obj->GetGridRef().isValid());
|
||||
}
|
||||
|
||||
/** an object of interested exits the grid
|
||||
*/
|
||||
//Actually an unlink is enough, no need to go through the container
|
||||
template<class SPECIFIC_OBJECT> void RemoveWorldObject(SPECIFIC_OBJECT *obj)
|
||||
{
|
||||
if (!i_objects.template remove<SPECIFIC_OBJECT>(obj))
|
||||
ASSERT(false);
|
||||
ASSERT(obj->GetGridRef().isValid());
|
||||
i_objects.template remove<SPECIFIC_OBJECT>(obj);
|
||||
ASSERT(!obj->GetGridRef().isValid());
|
||||
}
|
||||
|
||||
/** Refreshes/update the grid. This required for remote grids.
|
||||
@@ -104,16 +107,18 @@ class Grid
|
||||
*/
|
||||
template<class SPECIFIC_OBJECT> void AddGridObject(SPECIFIC_OBJECT *obj)
|
||||
{
|
||||
if (!i_container.template insert<SPECIFIC_OBJECT>(obj))
|
||||
ASSERT(false);
|
||||
ASSERT(!obj->GetGridRef().isValid());
|
||||
i_container.template insert<SPECIFIC_OBJECT>(obj);
|
||||
ASSERT(obj->GetGridRef().isValid());
|
||||
}
|
||||
|
||||
/** Removes a containter type object from the grid
|
||||
*/
|
||||
template<class SPECIFIC_OBJECT> void RemoveGridObject(SPECIFIC_OBJECT *obj)
|
||||
{
|
||||
if (!i_container.template remove<SPECIFIC_OBJECT>(obj))
|
||||
ASSERT(false);
|
||||
ASSERT(obj->GetGridRef().isValid());
|
||||
i_container.template remove<SPECIFIC_OBJECT>(obj);
|
||||
ASSERT(!obj->GetGridRef().isValid());
|
||||
}
|
||||
|
||||
/*bool NoWorldObjectInGrid() const
|
||||
|
||||
@@ -120,6 +120,7 @@ class NGrid
|
||||
void ResetTimeTracker(time_t interval) { i_GridInfo.ResetTimeTracker(interval); }
|
||||
void UpdateTimeTracker(time_t diff) { i_GridInfo.UpdateTimeTracker(diff); }
|
||||
|
||||
/*
|
||||
template<class SPECIFIC_OBJECT> void AddWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj)
|
||||
{
|
||||
GetGridType(x, y).AddWorldObject(obj);
|
||||
@@ -139,6 +140,7 @@ class NGrid
|
||||
{
|
||||
GetGridType(x, y).RemoveGridObject(obj);
|
||||
}
|
||||
*/
|
||||
|
||||
// Visit all Grids (cells) in NGrid (grid)
|
||||
template<class T, class TT>
|
||||
|
||||
Reference in New Issue
Block a user