Otclient  14/8/2020
Position Class Reference

#include <position.h>

Public Member Functions

 Position ()
 
 Position (uint16 x, uint16 y, uint8 z)
 
 Position (const Position &position)=default
 
Position translatedToDirection (Otc::Direction direction)
 
Position translatedToReverseDirection (Otc::Direction direction)
 
std::vector< PositiontranslatedToDirections (const std::vector< Otc::Direction > &dirs) const
 
double getAngleFromPosition (const Position &position) const
 
Otc::Direction getDirectionFromPosition (const Position &position) const
 
bool isMapPosition () const
 
bool isValid () const
 
float distance (const Position &pos) const
 
int manhattanDistance (const Position &pos) const
 
void translate (int dx, int dy, short dz=0)
 
Position translated (int dx, int dy, short dz=0) const
 
Position operator+ (const Position &other) const
 
Positionoperator+= (const Position &other)
 
Position operator- (const Position &other) const
 
Positionoperator-= (const Position &other)
 
Position operator+ (const Point &other) const
 
Positionoperator+= (const Point &other)
 
Positionoperator= (const Position &other)
 
bool operator== (const Position &other) const
 
bool operator!= (const Position &other) const
 
bool isInRange (const Position &pos, int xRange, int yRange) const
 
bool isInRange (const Position &pos, int minXRange, int maxXRange, int minYRange, int maxYRange) const
 
bool operator< (const Position &other) const
 
bool up (int n=1)
 
bool down (int n=1)
 
bool coveredUp (int n=1)
 
bool coveredDown (int n=1)
 

Static Public Member Functions

static double getAngleFromPositions (const Position &fromPos, const Position &toPos)
 
static Otc::Direction getDirectionFromPositions (const Position &fromPos, const Position &toPos)
 

Public Attributes

int x
 
int y
 
short z
 

Detailed Description

Definition at line 33 of file position.h.

Constructor & Destructor Documentation

◆ Position() [1/3]

Position::Position ( )
inline

Definition at line 36 of file position.h.

Here is the caller graph for this function:

◆ Position() [2/3]

Position::Position ( uint16  x,
uint16  y,
uint8  z 
)
inline

Definition at line 37 of file position.h.

◆ Position() [3/3]

Position::Position ( const Position position)
default

Member Function Documentation

◆ coveredDown()

bool Position::coveredDown ( int  n = 1)
inline

Definition at line 234 of file position.h.

Here is the caller graph for this function:

◆ coveredUp()

bool Position::coveredUp ( int  n = 1)
inline

Definition at line 225 of file position.h.

Here is the caller graph for this function:

◆ distance()

float Position::distance ( const Position pos) const
inline

Definition at line 183 of file position.h.

Here is the caller graph for this function:

◆ down()

bool Position::down ( int  n = 1)
inline

Definition at line 216 of file position.h.

Here is the caller graph for this function:

◆ getAngleFromPosition()

double Position::getAngleFromPosition ( const Position position) const
inline

Definition at line 148 of file position.h.

Here is the call graph for this function:

◆ getAngleFromPositions()

static double Position::getAngleFromPositions ( const Position fromPos,
const Position toPos 
)
inlinestatic

Definition at line 134 of file position.h.

Here is the caller graph for this function:

◆ getDirectionFromPosition()

Otc::Direction Position::getDirectionFromPosition ( const Position position) const
inline

Definition at line 177 of file position.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDirectionFromPositions()

static Otc::Direction Position::getDirectionFromPositions ( const Position fromPos,
const Position toPos 
)
inlinestatic

Definition at line 152 of file position.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInRange() [1/2]

bool Position::isInRange ( const Position pos,
int  minXRange,
int  maxXRange,
int  minYRange,
int  maxYRange 
) const
inline

Definition at line 201 of file position.h.

◆ isInRange() [2/2]

bool Position::isInRange ( const Position pos,
int  xRange,
int  yRange 
) const
inline

Definition at line 200 of file position.h.

Here is the caller graph for this function:

◆ isMapPosition()

bool Position::isMapPosition ( ) const
inline

Definition at line 181 of file position.h.

Here is the caller graph for this function:

◆ isValid()

bool Position::isValid ( ) const
inline

Definition at line 182 of file position.h.

Here is the caller graph for this function:

◆ manhattanDistance()

int Position::manhattanDistance ( const Position pos) const
inline

Definition at line 184 of file position.h.

◆ operator!=()

bool Position::operator!= ( const Position other) const
inline

Definition at line 199 of file position.h.

◆ operator+() [1/2]

Position Position::operator+ ( const Point other) const
inline

Definition at line 194 of file position.h.

Here is the call graph for this function:

◆ operator+() [2/2]

Position Position::operator+ ( const Position other) const
inline

Definition at line 189 of file position.h.

Here is the call graph for this function:

◆ operator+=() [1/2]

Position& Position::operator+= ( const Point other)
inline

Definition at line 195 of file position.h.

◆ operator+=() [2/2]

Position& Position::operator+= ( const Position other)
inline

Definition at line 190 of file position.h.

◆ operator-()

Position Position::operator- ( const Position other) const
inline

Definition at line 191 of file position.h.

Here is the call graph for this function:

◆ operator-=()

Position& Position::operator-= ( const Position other)
inline

Definition at line 192 of file position.h.

◆ operator<()

bool Position::operator< ( const Position other) const
inline

Definition at line 205 of file position.h.

◆ operator=()

Position& Position::operator= ( const Position other)
inline

Definition at line 197 of file position.h.

◆ operator==()

bool Position::operator== ( const Position other) const
inline

Definition at line 198 of file position.h.

◆ translate()

void Position::translate ( int  dx,
int  dy,
short  dz = 0 
)
inline

Definition at line 186 of file position.h.

◆ translated()

Position Position::translated ( int  dx,
int  dy,
short  dz = 0 
) const
inline

Definition at line 187 of file position.h.

Here is the caller graph for this function:

◆ translatedToDirection()

Position Position::translatedToDirection ( Otc::Direction  direction)
inline

Definition at line 41 of file position.h.

Here is the caller graph for this function:

◆ translatedToDirections()

std::vector<Position> Position::translatedToDirections ( const std::vector< Otc::Direction > &  dirs) const
inline

Definition at line 115 of file position.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ translatedToReverseDirection()

Position Position::translatedToReverseDirection ( Otc::Direction  direction)
inline

Definition at line 78 of file position.h.

◆ up()

bool Position::up ( int  n = 1)
inline

Definition at line 207 of file position.h.

Here is the caller graph for this function:

Member Data Documentation

◆ x

int Position::x

Definition at line 243 of file position.h.

◆ y

int Position::y

Definition at line 244 of file position.h.

◆ z

short Position::z

Definition at line 245 of file position.h.


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