Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

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.

Defines

#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
MapCoordinate getNeighbouringFieldCoordinate (const MapCoordinate &pos, int direc)
void getnextfield (int &x, int &y, int direc)
 changes x and y to the coordinates of the neighbouring field of (x/y) in the direction 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
int beeline (const Vehicle *a, const Vehicle *b)
 returns the distance between the units a and b
int beeline (const MapCoordinate &a, const MapCoordinate &b)
 returns the distance between map positions a and b
int beeline (int x1, int y1, int x2, int y2)
 returns the distance between (x1/y1) and (x2/y2)
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.


Define Documentation

#define checkvisibility
 

Definition at line 130 of file mapalgorithms.cpp.


Function Documentation

int beeline int  x1,
int  y1,
int  x2,
int  y2
 

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

Definition at line 394 of file mapalgorithms.cpp.

int beeline const MapCoordinate a,
const MapCoordinate b
 

returns the distance between map positions a and b

Definition at line 388 of file mapalgorithms.cpp.

int beeline const Vehicle a,
const Vehicle b
 

returns the distance between the units a and b

Definition at line 383 of file mapalgorithms.cpp.

Referenced by attackpossible(), attackpossible2n(), beeline(), calcMoveMalus(), ServiceChecker::check(), VehicleService::FieldSearch::checkBuilding2Vehicle(), VehicleService::FieldSearch::checkVehicle2Vehicle(), AStar3D::dist(), AStar::dist(), GuiFunctions::VehicleBuildingGui::eval(), GuiFunctions::ObjectBuildingGui::eval(), JumpDrive::fieldReachable(), tsearchreactionfireingunits::finalCheck(), StratAStar3D::getMoveCost(), StratAStar::getMoveCost(), BaseVehicleMovement::moveunitxy(), tunitattacksobject::setup(), tunitattacksbuilding::setup(), tunitattacksunit::setup(), tdrawgettempline::start(), tcomputeview::testfield(), VehicleService::FieldSearch::testfield(), tputresources::testfield(), SearchReconquerBuilding::testfield(), and Vehicle::vehicleconstructable().

void circularFieldIterator GameMap gamemap,
const MapCoordinate center,
int  startDist,
int  stopDist,
FieldIterationFunctor  functor
 

Definition at line 282 of file mapalgorithms.cpp.

References SearchFields::initsearch(), and SearchFields::startsearch().

Referenced by RecalculateAreaView::addView(), placeCurrentItem(), RecalculateAreaView::removeView(), AutoHarvestObjects::run(), and ServiceTargetSearcher::startSearch().

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 351 of file mapalgorithms.cpp.

int getdirection const MapCoordinate start,
const MapCoordinate dest
 

Definition at line 346 of file mapalgorithms.cpp.

Referenced by calcMoveMalus(), MapDisplayPG::displayUnitMovement(), getdirection(), BaseVehicleMovement::moveunitxy(), Vehicle::spawnMoveObjects(), AttackFormula::strength_hemming(), and windbeeline().

MapCoordinate getNeighbouringFieldCoordinate const MapCoordinate pos,
int  direc
 

Definition at line 300 of file mapalgorithms.cpp.

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

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

Definition at line 293 of file mapalgorithms.cpp.

Referenced by MapDisplayPG::displayUnitMovement(), AStar3D::findPath(), GuiFunctions::VehicleBuildingGui::init(), GuiFunctions::ObjectBuildingGui::init(), MapDisplayPG::initMovementStructure(), BaseVehicleMovement::moveunitxy(), TerrainItem::place(), MapNetwork::searchAllVehiclesNextToBuildings(), GuiFunctions::BuildingConstruction::setBuilding(), transformMap(), and UnitAttacksUnit_FakeHemming::UnitAttacksUnit_FakeHemming().

void getnextfield int &  x,
int &  y,
int  direc
 

changes x and y to the coordinates of the neighbouring field of (x/y) in the direction direc

Definition at line 308 of file mapalgorithms.cpp.

Referenced by calcMoveMalus(), ForestCalculation::calculateforest(), calculateobject(), ResourceNet::fieldavail(), AStar3D::findPath(), AStar::findPath(), getNeighbouringFieldCoordinate(), ForestCalculation::Smoothing::GetNeighbourMask(), MapNetwork::searchbuilding(), MapNetwork::searchfield(), tdrawgettempline::start(), SearchFields::startsearch(), and windbeeline().

float square float  i  )  [inline]
 

Definition at line 422 of file mapalgorithms.cpp.

int square int  i  ) 
 

Definition at line 417 of file mapalgorithms.cpp.


Variable Documentation

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

Definition at line 290 of file mapalgorithms.cpp.


Generated on Tue Jun 24 01:50:00 2008 for Advanced Strategic Command by  doxygen 1.4.2