diff options
author | Shauren <shauren.trinity@gmail.com> | 2025-06-06 11:21:01 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2025-06-06 11:21:01 +0200 |
commit | d2ddcd7b36a93f76f11941e240d2907bdc414e53 (patch) | |
tree | 202a54c01ac1fe667470f304fc92933e0495ea7d /src/server/game/Grids/NGrid.h | |
parent | f04cc7a8cb53f0d19b8fd24671333112cf5f3cf8 (diff) |
Core/Grids: Remove unused template parameter from Grid class
Diffstat (limited to 'src/server/game/Grids/NGrid.h')
-rw-r--r-- | src/server/game/Grids/NGrid.h | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/server/game/Grids/NGrid.h b/src/server/game/Grids/NGrid.h index 2babe75cc88..e9f22057e04 100644 --- a/src/server/game/Grids/NGrid.h +++ b/src/server/game/Grids/NGrid.h @@ -63,14 +63,13 @@ typedef enum template < uint32 N, -class ACTIVE_OBJECT, class WORLD_OBJECT_CONTAINER, class GRID_OBJECT_CONTAINER > class NGrid { public: - typedef Grid<ACTIVE_OBJECT, WORLD_OBJECT_CONTAINER, GRID_OBJECT_CONTAINER> GridType; + typedef Grid<WORLD_OBJECT_CONTAINER, GRID_OBJECT_CONTAINER> GridType; NGrid(uint32 id, int32 x, int32 y, time_t expiry, bool unload = true) : i_gridId(id), i_GridInfo(GridInfo(expiry, unload)), i_x(x), i_y(y), i_cellstate(GRID_STATE_INVALID), i_GridObjectDataLoaded(false) @@ -162,29 +161,46 @@ class NGrid GetGridType(x, y).Visit(visitor); } - //This gets the player count in grid - //I disable this to avoid confusion (active object usually means something else) - /* - uint32 GetActiveObjectCountInGrid() const + template<class T> + std::size_t GetWorldObjectCountInNGrid() const { uint32 count = 0; for (uint32 x = 0; x < N; ++x) for (uint32 y = 0; y < N; ++y) - count += i_cells[x][y].ActiveObjectsInGrid(); + count += i_cells[x][y].template GetWorldObjectCountInGrid<T>(); return count; } - */ template<class T> - uint32 GetWorldObjectCountInNGrid() const + std::size_t GetGridObjectCountInNGrid() const { uint32 count = 0; for (uint32 x = 0; x < N; ++x) for (uint32 y = 0; y < N; ++y) - count += i_cells[x][y].template GetWorldObjectCountInGrid<T>(); + count += i_cells[x][y].template GetGridObjectCountInGrid<T>(); return count; } + template<class T> + bool HasWorldObjectsInNGrid() const + { + for (uint32 x = 0; x < N; ++x) + for (uint32 y = 0; y < N; ++y) + if (i_cells[x][y].template GetWorldObjectCountInGrid<T>() != 0) + return true; + return false; + } + + template<class T> + bool HasGridObjectsInNGrid() const + { + for (uint32 x = 0; x < N; ++x) + for (uint32 y = 0; y < N; ++y) + if (i_cells[x][y].template GetGridObjectCountInGrid<T>() != 0) + return true; + return false; + } + private: uint32 i_gridId; GridInfo i_GridInfo; |