diff options
author | megamage <none@none.none> | 2011-12-20 17:05:08 -0500 |
---|---|---|
committer | megamage <none@none.none> | 2011-12-20 17:07:09 -0500 |
commit | 8cf2062c1f253f71696deeda6d7e1e393d115009 (patch) | |
tree | 17aa3ba004215a0b94db3b2da2658c4bb70b8032 /src/server/game/Grids/NGrid.h | |
parent | e1afd79b1ee2bceef56c8c768fdd984d5f03967c (diff) |
Update grid system. Try to fix some crashes and transport passengers (now they are despawned after a while).
Diffstat (limited to 'src/server/game/Grids/NGrid.h')
-rwxr-xr-x | src/server/game/Grids/NGrid.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/server/game/Grids/NGrid.h b/src/server/game/Grids/NGrid.h index 97a47f7d272..5a4a6015a00 100755 --- a/src/server/game/Grids/NGrid.h +++ b/src/server/game/Grids/NGrid.h @@ -158,14 +158,28 @@ class NGrid GetGridType(x, y).Visit(visitor); } - unsigned int ActiveObjectsInGrid(void) const + //This gets the player count in grid + //I disable this to avoid confusion (active object usually means something else) + /* + uint32 GetActiveObjectCountInGrid() const { - unsigned int count=0; - for (unsigned int x=0; x < N; ++x) - for (unsigned int y=0; y < N; ++y) + uint32 count = 0; + for (uint32 x = 0; x < N; ++x) + for (uint32 y = 0; y < N; ++y) count += i_cells[x][y].ActiveObjectsInGrid(); return count; } + */ + + template<class T> + uint32 GetWorldObjectCountInNGrid() const + { + uint32 count = 0; + for (uint32 x = 0; x < N; ++x) + for (uint32 y = 0; y < N; ++y) + count += i_cells[x][y].GetWorldObjectCountInGrid<T>(); + return count; + } private: uint32 i_gridId; |