diff options
author | megamage <none@none.none> | 2011-11-10 10:18:32 -0500 |
---|---|---|
committer | megamage <none@none.none> | 2011-11-10 10:18:32 -0500 |
commit | 23b3f16f3a4a27b7b24081b725666c5897fdbbee (patch) | |
tree | 31ec3e374620a6216df993bd09a580ce1d1c23f1 /src/server/game/Grids/Grid.h | |
parent | 7c1f1b3898320ad7329cf336ecae2abe5ed497fa (diff) |
Add some ASSERT in add/remove obj to/from grid.
Diffstat (limited to 'src/server/game/Grids/Grid.h')
-rwxr-xr-x | src/server/game/Grids/Grid.h | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/server/game/Grids/Grid.h b/src/server/game/Grids/Grid.h index a90915d49f0..cf6eb2471da 100755 --- a/src/server/game/Grids/Grid.h +++ b/src/server/game/Grids/Grid.h @@ -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 |