ScummVM API documentation
Ultima::Ultima4::MapCoords Class Reference

#include <map.h>

Inheritance diagram for Ultima::Ultima4::MapCoords:
Ultima::Ultima4::Coords

Public Member Functions

 MapCoords (int initx=0, int inity=0, int initz=0)
 
 MapCoords (const Coords &a)
 
MapCoordsoperator= (const Coords &a)
 
bool operator== (const MapCoords &a) const
 
bool operator!= (const MapCoords &a) const
 
bool operator< (const MapCoords &a) const
 
MapCoordswrap (const class Map *map)
 
MapCoordsputInBounds (const class Map *map)
 
MapCoordsmove (Direction d, const class Map *map=nullptr)
 
MapCoordsmove (int dx, int dy, const class Map *map=nullptr)
 
int getRelativeDirection (const MapCoords &c, const class Map *map=nullptr) const
 
Direction pathTo (const MapCoords &c, int valid_dirs=MASK_DIR_ALL, bool towards=true, const class Map *map=nullptr) const
 
Direction pathAway (const MapCoords &c, int valid_dirs=MASK_DIR_ALL) const
 
int movementDistance (const MapCoords &c, const class Map *map=nullptr) const
 
int distance (const MapCoords &c, const class Map *map=nullptr) const
 
- Public Member Functions inherited from Ultima::Ultima4::Coords
 Coords (int initx=0, int inity=0, int initz=0)
 
bool operator== (const Coords &a) const
 
bool operator!= (const Coords &a) const
 

Static Public Member Functions

static MapCoords nowhere ()
 

Additional Inherited Members

- Public Attributes inherited from Ultima::Ultima4::Coords
int x
 
int y
 
int z
 

Detailed Description

MapCoords class

Member Function Documentation

◆ getRelativeDirection()

int Ultima::Ultima4::MapCoords::getRelativeDirection ( const MapCoords c,
const class Map map = nullptr 
) const

Returns a mask of directions that indicate where one point is relative to another. For instance, if the object at (x, y) is northeast of (c.x, c.y), then this function returns (MASK_DIR(DIR_NORTH) | MASK_DIR(DIR_EAST)) This function also takes into account map boundaries and adjusts itself accordingly. If the two coordinates are not on the same z-plane, then this function return DIR_NONE.

◆ pathTo()

Direction Ultima::Ultima4::MapCoords::pathTo ( const MapCoords c,
int  valid_dirs = MASK_DIR_ALL,
bool  towards = true,
const class Map map = nullptr 
) const

Finds the appropriate direction to travel to get from one point to another. This algorithm will avoid getting trapped behind simple obstacles, but still fails with anything mildly complicated. This function also takes into account map boundaries and adjusts itself accordingly, provided the 'map' parameter is passed

◆ pathAway()

Direction Ultima::Ultima4::MapCoords::pathAway ( const MapCoords c,
int  valid_dirs = MASK_DIR_ALL 
) const

Finds the appropriate direction to travel to move away from one point

◆ movementDistance()

int Ultima::Ultima4::MapCoords::movementDistance ( const MapCoords c,
const class Map map = nullptr 
) const

Finds the movement distance (not using diagonals) from point a to point b on a map, taking into account map boundaries and such. If the two coords are not on the same z-plane, then this function returns -1;

◆ distance()

int Ultima::Ultima4::MapCoords::distance ( const MapCoords c,
const class Map map = nullptr 
) const

Finds the distance (using diagonals) from point a to point b on a map If the two coordinates are not on the same z-plane, then this function returns -1. This function also takes into account map boundaries.

◆ nowhere()

static MapCoords Ultima::Ultima4::MapCoords::nowhere ( )
inlinestatic

Returns true if the co-ordinates point to nowhere


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