Otclient 1.0  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 bool isDiagonal (const Otc::Direction dir)
 
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 254 of file position.h.

Here is the caller graph for this function:

◆ coveredUp()

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

Definition at line 243 of file position.h.

Here is the caller graph for this function:

◆ distance()

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

Definition at line 197 of file position.h.

Here is the caller graph for this function:

◆ down()

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

Definition at line 232 of file position.h.

Here is the caller graph for this function:

◆ getAngleFromPosition()

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

Definition at line 154 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 139 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 190 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 159 of file position.h.

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

◆ isDiagonal()

static bool Position::isDiagonal ( const Otc::Direction  dir)
inlinestatic

Definition at line 137 of file position.h.

◆ isInRange() [1/2]

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

Definition at line 215 of file position.h.

◆ isInRange() [2/2]

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

Definition at line 214 of file position.h.

Here is the caller graph for this function:

◆ isMapPosition()

bool Position::isMapPosition ( ) const
inline

Definition at line 195 of file position.h.

Here is the caller graph for this function:

◆ isValid()

bool Position::isValid ( ) const
inline

Definition at line 196 of file position.h.

Here is the caller graph for this function:

◆ manhattanDistance()

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

Definition at line 198 of file position.h.

◆ operator!=()

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

Definition at line 213 of file position.h.

◆ operator+() [1/2]

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

Definition at line 208 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 203 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 209 of file position.h.

◆ operator+=() [2/2]

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

Definition at line 204 of file position.h.

◆ operator-()

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

Definition at line 205 of file position.h.

Here is the call graph for this function:

◆ operator-=()

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

Definition at line 206 of file position.h.

◆ operator<()

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

Definition at line 220 of file position.h.

◆ operator=()

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

Definition at line 211 of file position.h.

◆ operator==()

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

Definition at line 212 of file position.h.

◆ translate()

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

Definition at line 200 of file position.h.

◆ translated()

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

Definition at line 201 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 117 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 79 of file position.h.

◆ up()

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

Definition at line 222 of file position.h.

Here is the caller graph for this function:

Member Data Documentation

◆ x

int Position::x

Definition at line 265 of file position.h.

◆ y

int Position::y

Definition at line 266 of file position.h.

◆ z

short Position::z

Definition at line 267 of file position.h.


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