OregonCore  revision be9e804-git
Your Favourite TBC server
CoordPair< LIMIT > Struct Template Reference

#include <GridDefines.h>

Public Member Functions

 CoordPair (uint32 x=0, uint32 y=0)
 
 CoordPair (const CoordPair< LIMIT > &obj)
 
bool operator== (const CoordPair< LIMIT > &obj) const
 
bool operator!= (const CoordPair< LIMIT > &obj) const
 
CoordPair< LIMIT > & operator= (const CoordPair< LIMIT > &obj)
 
void operator<< (const uint32 val)
 
void operator>> (const uint32 val)
 
void operator-= (const uint32 val)
 
void operator+= (const uint32 val)
 
bool IsCoordValid () const
 
CoordPairnormalize ()
 
uint32 GetId () const
 

Public Attributes

uint32 x_coord
 
uint32 y_coord
 

Detailed Description

template<const unsigned int LIMIT>
struct CoordPair< LIMIT >

Definition at line 73 of file GridDefines.h.

Constructor & Destructor Documentation

template<const unsigned int LIMIT>
CoordPair< LIMIT >::CoordPair ( uint32  x = 0,
uint32  y = 0 
)
inline

Definition at line 75 of file GridDefines.h.

75 : x_coord(x), y_coord(y) {}
uint32 y_coord
Definition: GridDefines.h:142
uint32 x_coord
Definition: GridDefines.h:141
template<const unsigned int LIMIT>
CoordPair< LIMIT >::CoordPair ( const CoordPair< LIMIT > &  obj)
inline

Definition at line 76 of file GridDefines.h.

76 : x_coord(obj.x_coord), y_coord(obj.y_coord) {}
uint32 y_coord
Definition: GridDefines.h:142
uint32 x_coord
Definition: GridDefines.h:141

Member Function Documentation

template<const unsigned int LIMIT>
bool CoordPair< LIMIT >::IsCoordValid ( ) const
inline

Definition at line 124 of file GridDefines.h.

Referenced by Cell::Visit().

125  {
126  return x_coord < LIMIT && y_coord < LIMIT;
127  }
uint32 y_coord
Definition: GridDefines.h:142
uint32 x_coord
Definition: GridDefines.h:141
template<const unsigned int LIMIT>
CoordPair& CoordPair< LIMIT >::normalize ( )
inline

Definition at line 129 of file GridDefines.h.

Referenced by Cell::CalculateCellArea().

130  {
131  x_coord = std::min(x_coord, LIMIT - 1);
132  y_coord = std::min(y_coord, LIMIT - 1);
133  return *this;
134  }
uint32 y_coord
Definition: GridDefines.h:142
uint32 x_coord
Definition: GridDefines.h:141
template<const unsigned int LIMIT>
bool CoordPair< LIMIT >::operator!= ( const CoordPair< LIMIT > &  obj) const
inline

Definition at line 81 of file GridDefines.h.

82  {
83  return !operator == (obj);
84  }
bool operator==(const CoordPair< LIMIT > &obj) const
Definition: GridDefines.h:77
template<const unsigned int LIMIT>
void CoordPair< LIMIT >::operator+= ( const uint32  val)
inline

Definition at line 116 of file GridDefines.h.

117  {
118  if (y_coord + val < LIMIT)
119  y_coord += val;
120  else
121  y_coord = LIMIT - 1;
122  }
uint32 y_coord
Definition: GridDefines.h:142
template<const unsigned int LIMIT>
void CoordPair< LIMIT >::operator-= ( const uint32  val)
inline

Definition at line 108 of file GridDefines.h.

109  {
110  if (y_coord > val)
111  y_coord -= val;
112  else
113  y_coord = 0;
114  }
uint32 y_coord
Definition: GridDefines.h:142
template<const unsigned int LIMIT>
void CoordPair< LIMIT >::operator<< ( const uint32  val)
inline

Definition at line 92 of file GridDefines.h.

93  {
94  if (x_coord > val)
95  x_coord -= val;
96  else
97  x_coord = 0;
98  }
uint32 x_coord
Definition: GridDefines.h:141
template<const unsigned int LIMIT>
CoordPair<LIMIT>& CoordPair< LIMIT >::operator= ( const CoordPair< LIMIT > &  obj)
inline

Definition at line 85 of file GridDefines.h.

86  {
87  x_coord = obj.x_coord;
88  y_coord = obj.y_coord;
89  return *this;
90  }
uint32 y_coord
Definition: GridDefines.h:142
uint32 x_coord
Definition: GridDefines.h:141
template<const unsigned int LIMIT>
bool CoordPair< LIMIT >::operator== ( const CoordPair< LIMIT > &  obj) const
inline

Definition at line 77 of file GridDefines.h.

78  {
79  return (obj.x_coord == x_coord && obj.y_coord == y_coord);
80  }
uint32 y_coord
Definition: GridDefines.h:142
uint32 x_coord
Definition: GridDefines.h:141
template<const unsigned int LIMIT>
void CoordPair< LIMIT >::operator>> ( const uint32  val)
inline

Definition at line 100 of file GridDefines.h.

101  {
102  if (x_coord + val < LIMIT)
103  x_coord += val;
104  else
105  x_coord = LIMIT - 1;
106  }
uint32 x_coord
Definition: GridDefines.h:141

Member Data Documentation


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