18#ifndef TRINITY_GRIDDEFINES_H
19#define TRINITY_GRIDDEFINES_H
36#define MAX_NUMBER_OF_CELLS 8
38#define MAX_NUMBER_OF_GRIDS 64
40#define SIZE_OF_GRIDS 533.3333f
41#define CENTER_GRID_ID (MAX_NUMBER_OF_GRIDS/2)
43#define CENTER_GRID_OFFSET (SIZE_OF_GRIDS/2)
45#define MIN_GRID_DELAY (MINUTE*IN_MILLISECONDS)
46#define MIN_MAP_UPDATE_DELAY 1
48#define SIZE_OF_GRID_CELL (SIZE_OF_GRIDS/MAX_NUMBER_OF_CELLS)
50#define CENTER_GRID_CELL_ID (MAX_NUMBER_OF_CELLS*MAX_NUMBER_OF_GRIDS/2)
51#define CENTER_GRID_CELL_OFFSET (SIZE_OF_GRID_CELL/2)
53#define TOTAL_NUMBER_OF_CELLS_PER_MAP (MAX_NUMBER_OF_GRIDS*MAX_NUMBER_OF_CELLS)
55#define MAP_RESOLUTION 128
57#define MAP_SIZE (SIZE_OF_GRIDS*MAX_NUMBER_OF_GRIDS)
58#define MAP_HALFSIZE (MAP_SIZE/2)
60#define MAX_HEIGHT 100000.0f
61#define INVALID_HEIGHT -100000.0f
62#define MAX_FALL_DISTANCE 250000.0f
63#define DEFAULT_HEIGHT_SEARCH 50.0f
104template<u
int32 LIMIT>
108 : x_coord(x), y_coord(y)
112 : x_coord(obj.x_coord), y_coord(obj.y_coord)
132 if (x_coord + val < LIMIT)
148 if (y_coord + val < LIMIT)
156 return x_coord < LIMIT && y_coord < LIMIT;
161 x_coord = std::min(x_coord, LIMIT - 1);
162 y_coord = std::min(y_coord, LIMIT - 1);
168 return y_coord * LIMIT + x_coord;
182 template<
class RET_TYPE,
int CENTER_VAL>
183 inline RET_TYPE
Compute(
float x,
float y,
float center_offset,
float size)
186 double x_offset = (double(x) - center_offset)/
size;
187 double y_offset = (double(y) - center_offset)/
size;
189 int x_val = int(x_offset + CENTER_VAL + 0.5);
190 int y_val = int(y_offset + CENTER_VAL + 0.5);
191 return RET_TYPE(x_val, y_val);
233 return std::isfinite(c) && (std::fabs(c) <=
MAP_HALFSIZE - 0.5f);
GridRefManager< Corpse > CorpseMapType
GridRefManager< DynamicObject > DynamicObjectMapType
GridRefManager< Creature > CreatureMapType
GridRefManager< Player > PlayerMapType
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
TypeMapContainer< AllWorldObjectTypes > WorldTypeMapContainer
TypeMapContainer< AllGridObjectTypes > GridTypeMapContainer
GridRefManager< Conversation > ConversationMapType
#define CENTER_GRID_CELL_OFFSET
GridRefManager< AreaTrigger > AreaTriggerMapType
#define MAX_NUMBER_OF_GRIDS
#define CENTER_GRID_CELL_ID
#define SIZE_OF_GRID_CELL
CoordPair< TOTAL_NUMBER_OF_CELLS_PER_MAP > CellCoord
GridRefManager< SceneObject > SceneObjectMapType
#define CENTER_GRID_OFFSET
typedef TYPELIST_8(Creature, GameObject, DynamicObject, Pet, Corpse, AreaTrigger, SceneObject, Conversation) AllMapStoredObjectTypes
@ GRID_MAP_TYPE_MASK_PLAYER
@ GRID_MAP_TYPE_MASK_CREATURE
@ GRID_MAP_TYPE_MASK_CONVERSATION
@ GRID_MAP_TYPE_MASK_SCENEOBJECT
@ GRID_MAP_TYPE_MASK_GAMEOBJECT
@ GRID_MAP_TYPE_MASK_DYNAMICOBJECT
@ GRID_MAP_TYPE_MASK_CORPSE
@ GRID_MAP_TYPE_MASK_AREATRIGGER
typedef TYPELIST_7(GameObject, Creature, DynamicObject, Corpse, AreaTrigger, SceneObject, Conversation) AllGridObjectTypes
GridRefManager< GameObject > GameObjectMapType
typedef TYPELIST_4(Player, Creature, Corpse, DynamicObject) AllWorldObjectTypes
NGrid< MAX_NUMBER_OF_CELLS, Player, AllWorldObjectTypes, AllGridObjectTypes > NGridType
Grid< Player, AllWorldObjectTypes, AllGridObjectTypes > GridType
GridCoord ComputeGridCoordSimple(float x, float y)
bool IsValidMapCoord(float x, float y, float z, float o)
CellCoord ComputeCellCoord(float x, float y, float &x_off, float &y_off)
RET_TYPE Compute(float x, float y, float center_offset, float size)
void NormalizeMapCoord(float &c)
GridCoord ComputeGridCoord(float x, float y)
constexpr std::size_t size()
bool IsCoordValid() const
CoordPair< LIMIT > & operator=(const CoordPair< LIMIT > &obj)
CoordPair(uint32 x=0, uint32 y=0)
CoordPair(const CoordPair< LIMIT > &obj)
friend bool operator==(CoordPair const &p1, CoordPair const &p2)=default