Core/Grids: Minor Grid/NGrid refactor - make TypeMapContainer be its direct template parameter instead of passing in TypeList

This commit is contained in:
Shauren
2025-01-05 15:14:41 +01:00
parent cc31fe491f
commit e245e8ad12
4 changed files with 19 additions and 19 deletions

View File

@@ -39,8 +39,8 @@ template<class A, class T, class O> class GridLoader;
template
<
class ACTIVE_OBJECT,
class WORLD_OBJECT_TYPES,
class GRID_OBJECT_TYPES
class WORLD_OBJECT_CONTAINER,
class GRID_OBJECT_CONTAINER
>
class Grid
{
@@ -85,14 +85,14 @@ class Grid
// Visit grid objects
template<class T>
void Visit(TypeContainerVisitor<T, TypeMapContainer<GRID_OBJECT_TYPES> > &visitor)
void Visit(TypeContainerVisitor<T, GRID_OBJECT_CONTAINER> &visitor)
{
visitor.Visit(i_container);
}
// Visit world objects
template<class T>
void Visit(TypeContainerVisitor<T, TypeMapContainer<WORLD_OBJECT_TYPES> > &visitor)
void Visit(TypeContainerVisitor<T, WORLD_OBJECT_CONTAINER> &visitor)
{
visitor.Visit(i_objects);
}
@@ -134,8 +134,8 @@ class Grid
}*/
private:
TypeMapContainer<GRID_OBJECT_TYPES> i_container;
TypeMapContainer<WORLD_OBJECT_TYPES> i_objects;
GRID_OBJECT_CONTAINER i_container;
WORLD_OBJECT_CONTAINER i_objects;
//typedef std::set<void*> ActiveGridObjects;
//ActiveGridObjects m_activeGridObjects;
};

View File

@@ -89,18 +89,18 @@ enum GridMapTypeMask
GRID_MAP_TYPE_MASK_ALL = 0xFF
};
extern template class Grid<Player, AllWorldObjectTypes, AllGridObjectTypes>;
extern template class NGrid<MAX_NUMBER_OF_CELLS, Player, AllWorldObjectTypes, AllGridObjectTypes>;
extern template class TypeMapContainer<AllGridObjectTypes>;
extern template class TypeMapContainer<AllWorldObjectTypes>;
typedef Grid<Player, AllWorldObjectTypes, AllGridObjectTypes> GridType;
typedef NGrid<MAX_NUMBER_OF_CELLS, Player, AllWorldObjectTypes, AllGridObjectTypes> NGridType;
typedef TypeMapContainer<AllGridObjectTypes> GridTypeMapContainer;
typedef TypeMapContainer<AllWorldObjectTypes> WorldTypeMapContainer;
extern template class Grid<Player, WorldTypeMapContainer, GridTypeMapContainer>;
extern template class NGrid<MAX_NUMBER_OF_CELLS, Player, WorldTypeMapContainer, GridTypeMapContainer>;
typedef Grid<Player, WorldTypeMapContainer, GridTypeMapContainer> GridType;
typedef NGrid<MAX_NUMBER_OF_CELLS, Player, WorldTypeMapContainer, GridTypeMapContainer> NGridType;
template<uint32 LIMIT>
struct CoordPair
{

View File

@@ -29,8 +29,8 @@ GridInfo::GridInfo(time_t expiry, bool unload /*= true */) : i_timer(expiry), vi
{
}
template class Grid<Player, AllWorldObjectTypes, AllGridObjectTypes>;
template class NGrid<MAX_NUMBER_OF_CELLS, Player, AllWorldObjectTypes, AllGridObjectTypes>;
template class Grid<Player, WorldTypeMapContainer, GridTypeMapContainer>;
template class NGrid<MAX_NUMBER_OF_CELLS, Player, WorldTypeMapContainer, GridTypeMapContainer>;
template class TC_GAME_API TypeMapContainer<AllGridObjectTypes>;
template class TC_GAME_API TypeMapContainer<AllWorldObjectTypes>;

View File

@@ -63,13 +63,13 @@ template
<
uint32 N,
class ACTIVE_OBJECT,
class WORLD_OBJECT_TYPES,
class GRID_OBJECT_TYPES
class WORLD_OBJECT_CONTAINER,
class GRID_OBJECT_CONTAINER
>
class NGrid
{
public:
typedef Grid<ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> GridType;
typedef Grid<ACTIVE_OBJECT, 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)
@@ -93,7 +93,7 @@ class NGrid
int32 getX() const { return i_x; }
int32 getY() const { return i_y; }
void link(GridRefManager<NGrid<N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> >* pTo)
void link(GridRefManager<NGrid>* pTo)
{
i_Reference.link(pTo, this);
}
@@ -173,7 +173,7 @@ class NGrid
private:
uint32 i_gridId;
GridInfo i_GridInfo;
GridReference<NGrid<N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> > i_Reference;
GridReference<NGrid> i_Reference;
int32 i_x;
int32 i_y;
grid_state_t i_cellstate;