Advanced Strategic Command
Classes | Typedefs | Functions | Variables
mapalgorithms.h File Reference
#include "typen.h"
#include "vehicle.h"
#include "loki/Functor.h"
#include "loki/Typelist.h"
Include dependency graph for mapalgorithms.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SearchFields
 searches fields in hexagonal "circles" around a field and calls testfield for each field More...
 
class  tdrawgettempline
 draws a straight line on the hexagonal map and calls putpix8 for each field. More...
 
class  WindMovement
 caches some calculations for the effects that wind has on the movement of units More...
 

Typedefs

typedef Loki::Functor< void,
LOKI_TYPELIST_1(const
MapCoordinate &) > 
FieldIterationFunctor
 

Functions

void circularFieldIterator (GameMap *gamemap, const MapCoordinate &center, int startDist, int stopDist, FieldIterationFunctor functor)
 
int getnextdx (int dir, int y)
 
int getnextdy (int dir)
 
MapCoordinate3D getNeighbouringFieldCoordinate (const MapCoordinate3D &pos, int direc)
 returns the coordinate of the field that is adjecent to the given field in the direction of direc More...
 
MapCoordinate getNeighbouringFieldCoordinate (const MapCoordinate &pos, int direc)
 
int getdirection (int x1, int y1, int x2, int y2)
 gets the direction from x1/y1 to x2/y2 More...
 
int getdirection (const MapCoordinate &start, const MapCoordinate &dest)
 
int beeline (int x1, int y1, int x2, int y2)
 returns the distance between (x1/y1) and (x2/y2) More...
 
int beeline (const Vehicle *a, const Vehicle *b)
 returns the distance between the units a and b More...
 
int beeline (const MapCoordinate &a, const MapCoordinate &b)
 returns the distance between map positions a and b More...
 

Variables

static const int dxLookup [] = { 0, 1, 1, 0, -1, -1 }
 
static const int dyLookup [] = { -2, -1, 1, 2, 1, -1 }
 

Typedef Documentation

typedef Loki::Functor<void, LOKI_TYPELIST_1(const MapCoordinate&) > FieldIterationFunctor

Definition at line 43 of file mapalgorithms.h.

Function Documentation

int beeline ( int  x1,
int  y1,
int  x2,
int  y2 
)

returns the distance between (x1/y1) and (x2/y2)

Definition at line 351 of file mapalgorithms.cpp.

References max(), and minmalq.

int beeline ( const Vehicle a,
const Vehicle b 
)
int beeline ( const MapCoordinate a,
const MapCoordinate b 
)

returns the distance between map positions a and b

Definition at line 345 of file mapalgorithms.cpp.

References beeline(), MapCoordinate::x, and MapCoordinate::y.

void circularFieldIterator ( GameMap gamemap,
const MapCoordinate center,
int  startDist,
int  stopDist,
FieldIterationFunctor  functor 
)
int getdirection ( int  x1,
int  y1,
int  x2,
int  y2 
)

gets the direction from x1/y1 to x2/y2

Returns
-1 if the fields are identical

Definition at line 318 of file mapalgorithms.cpp.

int getdirection ( const MapCoordinate start,
const MapCoordinate dest 
)
MapCoordinate3D getNeighbouringFieldCoordinate ( const MapCoordinate3D pos,
int  direc 
)
MapCoordinate getNeighbouringFieldCoordinate ( const MapCoordinate pos,
int  direc 
)

Definition at line 305 of file mapalgorithms.cpp.

References getnextdx(), getnextdy(), MapCoordinate::x, and MapCoordinate::y.

int getnextdx ( int  dir,
int  y 
)
inline
int getnextdy ( int  dir)
inline

Variable Documentation

const int dxLookup[] = { 0, 1, 1, 0, -1, -1 }
static

Definition at line 76 of file mapalgorithms.h.

Referenced by getnextdx().

const int dyLookup[] = { -2, -1, 1, 2, 1, -1 }
static

Definition at line 79 of file mapalgorithms.h.

Referenced by getnextdy().