Advanced Strategic Command
Classes | Macros | Functions | Variables
mapalgorithms.cpp File Reference

Routines for working with hexagonal grids. More...

#include <math.h>
#include "mapalgorithms.h"
#include "typen.h"
#include "vehicletype.h"
#include "errors.h"
#include "gamemap.h"
Include dependency graph for mapalgorithms.cpp:

Go to the source code of this file.

Classes

class  SearchFieldsIterator
 

Macros

#define checkvisibility
 

Functions

void circularFieldIterator (GameMap *gamemap, const MapCoordinate &center, int startDist, int stopDist, FieldIterationFunctor functor)
 
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 (const MapCoordinate &start, const MapCoordinate &dest)
 
int getdirection (int x1, int y1, int x2, int y2)
 gets the direction from x1/y1 to 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...
 
int beeline (int x1, int y1, int x2, int y2)
 returns the distance between (x1/y1) and (x2/y2) More...
 
int square (int i)
 
float square (float i)
 

Variables

int ccmpheighchangemovedir [6] = {0, 1, 5, 2, 4, 3 }
 

Detailed Description

Routines for working with hexagonal grids.

Definition in file mapalgorithms.cpp.

Macro Definition Documentation

#define checkvisibility

Definition at line 131 of file mapalgorithms.cpp.

Function Documentation

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.

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.

void circularFieldIterator ( GameMap gamemap,
const MapCoordinate center,
int  startDist,
int  stopDist,
FieldIterationFunctor  functor 
)
int getdirection ( const MapCoordinate start,
const MapCoordinate dest 
)
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.

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 square ( int  i)
inline

Definition at line 376 of file mapalgorithms.cpp.

Referenced by WindMovement::WindMovement().

float square ( float  i)
inline

Definition at line 381 of file mapalgorithms.cpp.

Variable Documentation

int ccmpheighchangemovedir[6] = {0, 1, 5, 2, 4, 3 }

Definition at line 294 of file mapalgorithms.cpp.