Advanced Strategic Command
|
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"
Go to the source code of this file.
Classes | |
class | SearchFieldsIterator |
Macros | |
#define | checkvisibility |
Functions | |
void | circularFieldIterator (GameMap *gamemap, const MapCoordinate ¢er, 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 } |
Routines for working with hexagonal grids.
Definition in file mapalgorithms.cpp.
#define checkvisibility |
Definition at line 131 of file mapalgorithms.cpp.
returns the distance between the units a and b
Definition at line 340 of file mapalgorithms.cpp.
References beeline(), Vehicle::xpos, and Vehicle::ypos.
Referenced by attackpossible(), attackpossible2n(), beeline(), calcMoveMalus(), ServiceChecker::check(), AStar3D::dist(), JumpDriveCommand::fieldReachable(), tsearchreactionfireingunits::finalCheck(), StratAStar3D::getMoveCost(), CursorDistSorter::operator()(), MoveUnit::runAction(), tunitattacksunit::setup(), tunitattacksbuilding::setup(), tunitattacksobject::setup(), tdrawgettempline::start(), tcomputeview::testfield(), tputresources::testfield(), SearchReconquerBuilding::testfield(), and Vehicle::vehicleconstructable().
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.
void circularFieldIterator | ( | GameMap * | gamemap, |
const MapCoordinate & | center, | ||
int | startDist, | ||
int | stopDist, | ||
FieldIterationFunctor | functor | ||
) |
Definition at line 286 of file mapalgorithms.cpp.
References SearchFields::initsearch(), and SearchFields::startsearch().
Referenced by RecalculateAreaView::addView(), ConstructUnitCommand::getFields(), placeCurrentItem(), RecalculateAreaView::removeView(), AutoHarvestObjects::run(), DiscoverResources::runAction(), PutObjectCommand::searchFields(), PutMineCommand::searchFields(), AttackCommand::searchTargets(), and ServiceTargetSearcher::startSearch().
int getdirection | ( | const MapCoordinate & | start, |
const MapCoordinate & | dest | ||
) |
Definition at line 313 of file mapalgorithms.cpp.
References getdirection(), MapCoordinate::x, and MapCoordinate::y.
Referenced by calcMoveMalus(), MapDisplayPG::displayUnitMovement(), getdirection(), MoveUnit::runAction(), Vehicle::spawnMoveObjects(), and AttackFormula::strength_hemming().
int getdirection | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2 | ||
) |
gets the direction from x1/y1 to x2/y2
Definition at line 318 of file mapalgorithms.cpp.
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 297 of file mapalgorithms.cpp.
References getnextdx(), getnextdy(), MapCoordinate::x, and MapCoordinate::y.
Referenced by MapDisplayPG::displayUnitMovement(), AStar3D::findPath(), DestructBuildingCommand::getFields(), ConstructBuildingCommand::getFields(), MapDisplayPG::initMovementStructure(), TerrainItem::place(), placeTerrain(), MoveUnit::runAction(), MapNetwork::searchAllVehiclesNextToBuildings(), transformMap(), and UnitAttacksUnit_FakeHemming::UnitAttacksUnit_FakeHemming().
MapCoordinate getNeighbouringFieldCoordinate | ( | const MapCoordinate & | pos, |
int | direc | ||
) |
Definition at line 305 of file mapalgorithms.cpp.
References getnextdx(), getnextdy(), MapCoordinate::x, and MapCoordinate::y.
|
inline |
Definition at line 376 of file mapalgorithms.cpp.
Referenced by WindMovement::WindMovement().
|
inline |
Definition at line 381 of file mapalgorithms.cpp.
int ccmpheighchangemovedir[6] = {0, 1, 5, 2, 4, 3 } |
Definition at line 294 of file mapalgorithms.cpp.