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
100template<u
int32 LIMIT>
104 : x_coord(x), y_coord(y) { }
116 if (x_coord + val < LIMIT)
132 if (y_coord + val < LIMIT)
140 return x_coord < LIMIT && y_coord < LIMIT;
145 return y_coord * LIMIT + x_coord;
159 template<
int32 LIMIT,
int32 CENTER_VAL>
163 double x_offset = (double(x) - center_offset) / size;
164 double y_offset = (double(y) - center_offset) / size;
166 int32 x_val =
int32(x_offset + CENTER_VAL + 0.5);
167 int32 y_val =
int32(y_offset + CENTER_VAL + 0.5);
169 x_val >= 0 ? x_val < LIMIT ? x_val : LIMIT - 1 : 0,
170 y_val >= 0 ? y_val < LIMIT ? y_val : LIMIT - 1 : 0
201 return std::isfinite(c) && (std::fabs(c) <=
MAP_HALFSIZE - 0.5f);
GridRefManager< Corpse > CorpseMapType
GridRefManager< DynamicObject > DynamicObjectMapType
GridRefManager< Creature > CreatureMapType
TypeListContainer< GridRefManagerContainer, Player, Creature, Corpse, DynamicObject > WorldTypeMapContainer
GridRefManager< Player > PlayerMapType
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
TypeListContainer< GridRefManagerContainer, GameObject, Creature, DynamicObject, Corpse, AreaTrigger, SceneObject, Conversation > GridTypeMapContainer
GridRefManager< Conversation > ConversationMapType
#define CENTER_GRID_CELL_OFFSET
GridRefManager< AreaTrigger > AreaTriggerMapType
#define MAX_NUMBER_OF_GRIDS
Grid< WorldTypeMapContainer, GridTypeMapContainer > GridType
#define SIZE_OF_GRID_CELL
NGrid< MAX_NUMBER_OF_CELLS, WorldTypeMapContainer, GridTypeMapContainer > NGridType
CoordPair< TOTAL_NUMBER_OF_CELLS_PER_MAP > CellCoord
GridRefManager< SceneObject > SceneObjectMapType
#define CENTER_GRID_OFFSET
@ 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
GridRefManager< GameObject > GameObjectMapType
constexpr GridCoord ComputeGridCoordSimple(float x, float y)
bool IsValidMapCoord(float c)
constexpr CoordPair< LIMIT > Compute(float x, float y, float center_offset, float size)
constexpr void NormalizeMapCoord(float &c)
constexpr CellCoord ComputeCellCoord(float x, float y)
constexpr GridCoord ComputeGridCoord(float x, float y)
friend constexpr bool operator==(CoordPair const &p1, CoordPair const &p2)=default
constexpr void inc_y(uint32 val)
constexpr void dec_y(uint32 val)
constexpr void dec_x(uint32 val)
constexpr uint32 GetId() const
constexpr CoordPair(uint32 x, uint32 y)
constexpr bool IsCoordValid() const
constexpr void inc_x(uint32 val)