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
86 : x_coord(x)
87 , y_coord(y)
88 {}
uint32 x_coord
Definition GridDefines.h:151
uint32 y_coord
Definition GridDefines.h:152

◆ CoordPair() [2/2]

template<uint32 LIMIT>
CoordPair< LIMIT >::CoordPair ( const CoordPair< LIMIT > &  obj)
inline
91 : x_coord(obj.x_coord)
92 , y_coord(obj.y_coord)
93 {}

Member Function Documentation

◆ dec_x()

template<uint32 LIMIT>
void CoordPair< LIMIT >::dec_x ( uint32  val)
inline
103 {
104 if (x_coord > val)
105 x_coord -= val;
106 else
107 x_coord = 0;
108 }

References CoordPair< LIMIT >::x_coord.

◆ dec_y()

template<uint32 LIMIT>
void CoordPair< LIMIT >::dec_y ( uint32  val)
inline
119 {
120 if (y_coord > val)
121 y_coord -= val;
122 else
123 y_coord = 0;
124 }

References CoordPair< LIMIT >::y_coord.

◆ GetId()

◆ inc_x()

template<uint32 LIMIT>
void CoordPair< LIMIT >::inc_x ( uint32  val)
inline
111 {
112 if (x_coord + val < LIMIT)
113 x_coord += val;
114 else
115 x_coord = LIMIT - 1;
116 }

References CoordPair< LIMIT >::x_coord.

◆ inc_y()

template<uint32 LIMIT>
void CoordPair< LIMIT >::inc_y ( uint32  val)
inline
127 {
128 if (y_coord + val < LIMIT)
129 y_coord += val;
130 else
131 y_coord = LIMIT - 1;
132 }

References CoordPair< LIMIT >::y_coord.

◆ IsCoordValid()

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

◆ normalize()

template<uint32 LIMIT>
CoordPair & CoordPair< LIMIT >::normalize ( )
inline
140 {
141 x_coord = std::min(x_coord, LIMIT - 1);
142 y_coord = std::min(y_coord, LIMIT - 1);
143 return *this;
144 }

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
96 {
97 x_coord = obj.x_coord;
98 y_coord = obj.y_coord;
99 return *this;
100 }

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: