19 #ifndef TRINITY_GRIDDEFINES_H
20 #define TRINITY_GRIDDEFINES_H
35 #define MAX_NUMBER_OF_CELLS 8
37 #define MAX_NUMBER_OF_GRIDS 64
39 #define SIZE_OF_GRIDS 533.3333f
40 #define CENTER_GRID_ID (MAX_NUMBER_OF_GRIDS/2)
42 #define CENTER_GRID_OFFSET (SIZE_OF_GRIDS/2)
44 #define MIN_GRID_DELAY (MINUTE*IN_MILLISECONDS)
45 #define MIN_MAP_UPDATE_DELAY 50
47 #define SIZE_OF_GRID_CELL (SIZE_OF_GRIDS/MAX_NUMBER_OF_CELLS)
49 #define CENTER_GRID_CELL_ID (MAX_NUMBER_OF_CELLS*MAX_NUMBER_OF_GRIDS/2)
50 #define CENTER_GRID_CELL_OFFSET (SIZE_OF_GRID_CELL/2)
52 #define TOTAL_NUMBER_OF_CELLS_PER_MAP (MAX_NUMBER_OF_GRIDS*MAX_NUMBER_OF_CELLS)
54 #define MAP_RESOLUTION 128
56 #define MAP_SIZE (SIZE_OF_GRIDS*MAX_NUMBER_OF_GRIDS)
57 #define MAP_HALFSIZE (MAP_SIZE/2)
88 template<u
int32 LIMIT>
159 template<u
int32 LIMIT>
165 template<u
int32 LIMIT>
176 template<
class RET_TYPE,
int CENTER_VAL>
177 inline RET_TYPE
Compute(
float x,
float y,
float center_offset,
float size)
180 double x_offset = (double(x) - center_offset)/size;
181 double y_offset = (double(y) - center_offset)/size;
183 int x_val = int(x_offset + CENTER_VAL + 0.5f);
184 int y_val = int(y_offset + CENTER_VAL + 0.5f);
185 return RET_TYPE(x_val, y_val);
220 return std::isfinite(c) && (std::fabs(c) <=
MAP_HALFSIZE - 0.5f);
CoordPair(const CoordPair< LIMIT > &obj)
Definition: GridDefines.h:95
TypeMapContainer< AllGridObjectTypes > GridTypeMapContainer
Definition: GridDefines.h:85
#define CENTER_GRID_CELL_ID
Definition: GridDefines.h:49
Definition: GridDefines.h:78
#define SIZE_OF_GRID_CELL
Definition: GridDefines.h:47
Definition: GridDefines.h:79
typedef TYPELIST_4(Player, Creature, Corpse, DynamicObject) AllWorldObjectTypes
#define SIZE_OF_GRIDS
Definition: GridDefines.h:39
Grid< Player, AllWorldObjectTypes, AllGridObjectTypes > GridType
Definition: GridDefines.h:82
CoordPair & normalize()
Definition: GridDefines.h:143
TypeMapContainer< AllWorldObjectTypes > WorldTypeMapContainer
Definition: GridDefines.h:86
#define MAP_HALFSIZE
Definition: GridDefines.h:57
GridCoord ComputeGridCoord(float x, float y)
Definition: GridDefines.h:188
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
RET_TYPE Compute(float x, float y, float center_offset, float size)
Definition: GridDefines.h:177
Definition: Creature.h:467
uint32 y_coord
Definition: GridDefines.h:156
uint32 x_coord
Definition: GridDefines.h:155
void inc_y(uint32 val)
Definition: GridDefines.h:130
Definition: GridDefines.h:77
void dec_y(uint32 val)
Definition: GridDefines.h:122
Definition: TypeContainer.h:86
typedef TYPELIST_6(Creature, GameObject, DynamicObject, Pet, Corpse, AreaTrigger) AllMapStoredObjectTypes
Definition: DynamicObject.h:35
T min(const T &x, const T &y)
Definition: g3dmath.h:305
Definition: GridDefines.h:76
Definition: GridReference.h:25
typedef TYPELIST_5(GameObject, Creature, DynamicObject, Corpse, AreaTrigger) AllGridObjectTypes
bool IsValidMapCoord(float c)
Definition: GridDefines.h:218
G3D::int16 z
Definition: Vector3int16.h:46
bool operator!=(const CoordPair< LIMIT > &p1, const CoordPair< LIMIT > &p2)
Definition: GridDefines.h:166
bool operator==(const CoordPair< LIMIT > &p1, const CoordPair< LIMIT > &p2)
Definition: GridDefines.h:160
Definition: GridDefines.h:75
uint32_t uint32
Definition: Define.h:150
G3D::int16 y
Definition: Vector2int16.h:38
Definition: GridDefines.h:89
Definition: GameObject.h:880
CoordPair< LIMIT > & operator=(const CoordPair< LIMIT > &obj)
Definition: GridDefines.h:99
bool IsCoordValid() const
Definition: GridDefines.h:138
void NormalizeMapCoord(float &c)
Definition: GridDefines.h:210
#define CENTER_GRID_OFFSET
Definition: GridDefines.h:42
#define CENTER_GRID_CELL_OFFSET
Definition: GridDefines.h:50
CoordPair< TOTAL_NUMBER_OF_CELLS_PER_MAP > CellCoord
Definition: GridDefines.h:172
void dec_x(uint32 val)
Definition: GridDefines.h:106
Definition: GridDefines.h:74
G3D::int16 x
Definition: Vector2int16.h:37
CoordPair(uint32 x=0, uint32 y=0)
Definition: GridDefines.h:91
NGrid< MAX_NUMBER_OF_CELLS, Player, AllWorldObjectTypes, AllGridObjectTypes > NGridType
Definition: GridDefines.h:83
CoordPair< MAX_NUMBER_OF_GRIDS > GridCoord
Definition: GridDefines.h:171
uint32 GetId() const
Definition: GridDefines.h:150
Definition: GridDefines.h:73
Definition: AreaTrigger.h:26
GridMapTypeMask
Definition: GridDefines.h:71
void inc_x(uint32 val)
Definition: GridDefines.h:114