AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
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
 

Detailed Description

template<uint32 LIMIT>
struct CoordPair< LIMIT >

Constructor & Destructor Documentation

◆ CoordPair() [1/2]

template<uint32 LIMIT>
CoordPair< LIMIT >::CoordPair ( uint32  x = 0,
uint32  y = 0 
)
inline
90 : x_coord(x)
91 , y_coord(y)
92 {}
uint32 x_coord
Definition GridDefines.h:155
uint32 y_coord
Definition GridDefines.h:156

◆ CoordPair() [2/2]

template<uint32 LIMIT>
CoordPair< LIMIT >::CoordPair ( const CoordPair< LIMIT > &  obj)
inline
95 : x_coord(obj.x_coord)
96 , y_coord(obj.y_coord)
97 {}

Member Function Documentation

◆ dec_x()

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 }

References CoordPair< LIMIT >::x_coord.

◆ dec_y()

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 }

References CoordPair< LIMIT >::y_coord.

◆ GetId()

◆ inc_x()

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 }

References CoordPair< LIMIT >::x_coord.

◆ inc_y()

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 }

References CoordPair< LIMIT >::y_coord.

◆ IsCoordValid()

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

◆ normalize()

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 }

References CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Referenced by Cell::CalculateCellArea().

◆ operator=()

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 }

References CoordPair< LIMIT >::x_coord, and CoordPair< LIMIT >::y_coord.

Member Data Documentation

◆ x_coord

◆ y_coord


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