TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CoordPair< LIMIT > Struct Template Reference

#include <GridDefines.h>

Public Member Functions

 CoordPair (uint32 x=0, uint32 y=0)
 
 CoordPair (const CoordPair< LIMIT > &obj)
 
CoordPair< LIMIT > & operator= (const CoordPair< LIMIT > &obj)
 
void dec_x (uint32 val)
 
void inc_x (uint32 val)
 
void dec_y (uint32 val)
 
void inc_y (uint32 val)
 
bool IsCoordValid () const
 
CoordPairnormalize ()
 
uint32 GetId () const
 

Public Attributes

uint32 x_coord
 
uint32 y_coord
 

Constructor & Destructor Documentation

template<uint32 LIMIT>
CoordPair< LIMIT >::CoordPair ( uint32  x = 0,
uint32  y = 0 
)
inline
92  : x_coord(x), y_coord(y)
93  { }
uint32 y_coord
Definition: GridDefines.h:156
uint32 x_coord
Definition: GridDefines.h:155
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37
template<uint32 LIMIT>
CoordPair< LIMIT >::CoordPair ( const CoordPair< LIMIT > &  obj)
inline
96  : x_coord(obj.x_coord), y_coord(obj.y_coord)
97  { }
uint32 y_coord
Definition: GridDefines.h:156
uint32 x_coord
Definition: GridDefines.h:155

Member Function Documentation

template<uint32 LIMIT>
void CoordPair< LIMIT >::dec_x ( uint32  val)
inline
107  {
108  if (x_coord > val)
109  x_coord -= val;
110  else
111  x_coord = 0;
112  }
uint32 x_coord
Definition: GridDefines.h:155
template<uint32 LIMIT>
void CoordPair< LIMIT >::dec_y ( uint32  val)
inline
123  {
124  if (y_coord > val)
125  y_coord -= val;
126  else
127  y_coord = 0;
128  }
uint32 y_coord
Definition: GridDefines.h:156
template<uint32 LIMIT>
uint32 CoordPair< LIMIT >::GetId ( ) const
inline
151  {
152  return y_coord * LIMIT + x_coord;
153  }
uint32 y_coord
Definition: GridDefines.h:156
uint32 x_coord
Definition: GridDefines.h:155

+ Here is the caller graph for this function:

template<uint32 LIMIT>
void CoordPair< LIMIT >::inc_x ( uint32  val)
inline
115  {
116  if (x_coord + val < LIMIT)
117  x_coord += val;
118  else
119  x_coord = LIMIT - 1;
120  }
uint32 x_coord
Definition: GridDefines.h:155
template<uint32 LIMIT>
void CoordPair< LIMIT >::inc_y ( uint32  val)
inline
131  {
132  if (y_coord + val < LIMIT)
133  y_coord += val;
134  else
135  y_coord = LIMIT - 1;
136  }
uint32 y_coord
Definition: GridDefines.h:156
template<uint32 LIMIT>
bool CoordPair< LIMIT >::IsCoordValid ( ) const
inline
139  {
140  return x_coord < LIMIT && y_coord < LIMIT;
141  }
uint32 y_coord
Definition: GridDefines.h:156
uint32 x_coord
Definition: GridDefines.h:155

+ Here is the caller graph for this function:

template<uint32 LIMIT>
CoordPair& CoordPair< LIMIT >::normalize ( )
inline
144  {
145  x_coord = std::min(x_coord, LIMIT - 1);
146  y_coord = std::min(y_coord, LIMIT - 1);
147  return *this;
148  }
uint32 y_coord
Definition: GridDefines.h:156
uint32 x_coord
Definition: GridDefines.h:155
T min(const T &x, const T &y)
Definition: g3dmath.h:305

+ Here is the caller graph for this function:

template<uint32 LIMIT>
CoordPair<LIMIT>& CoordPair< LIMIT >::operator= ( const CoordPair< LIMIT > &  obj)
inline
100  {
101  x_coord = obj.x_coord;
102  y_coord = obj.y_coord;
103  return *this;
104  }
uint32 y_coord
Definition: GridDefines.h:156
uint32 x_coord
Definition: GridDefines.h:155

Member Data Documentation

template<uint32 LIMIT>
uint32 CoordPair< LIMIT >::x_coord
template<uint32 LIMIT>
uint32 CoordPair< LIMIT >::y_coord

The documentation for this struct was generated from the following file: