#include <astar2.h>
Inheritance diagram for AStar3D:

Public Types | |
| typedef float | DistanceType |
| typedef vector< PathPoint > | Path |
Public Member Functions | |
| AStar3D (GameMap *actmap, Vehicle *veh, bool markTemps_=true, int maxDistance=maxint) | |
| void | registerOperationLimiter (OperationLimiter *ol) |
| the search can be restricted to certain operations | |
| void | findPath (const MapCoordinate3D &A, const vector< MapCoordinate3D > &B, Path &path) |
| searches for a path from A to B and stores it in path | |
| void | findPath (Path &path, const MapCoordinate3D &dest) |
| searches for a path from the unit's current position to dest and stores it in path | |
| void | findPath (Path &path, const vector< MapCoordinate3D > &dest) |
| searches for a path from the units current position to one of the dest fields and stores it in path | |
| void | findAllAccessibleFields (vector< MapCoordinate3D > *path=NULL) |
| searches for all fields that are within the range of maxDist and marks them. | |
| int | getDistance () |
| returns the distance of the last found path, or -1 on any error | |
| int | getTravelTime () |
| returns the number of turns that the unit will need to travel along the last found path | |
| const Node * | fieldVisited (const MapCoordinate3D &fld) |
| checks weather the field fld was among the visited fields during the last search | |
| int & | getFieldAccess (int x, int y) |
| int & | getFieldAccess (const MapCoordinate &mc) |
| virtual | ~AStar3D () |
Public Attributes | |
| Container | visited |
| the reachable fields | |
Static Public Attributes | |
| static const DistanceType | longestPath |
Protected Member Functions | |
| virtual DistanceType | getMoveCost (const MapCoordinate3D &start, const MapCoordinate3D &dest, const Vehicle *vehicle, bool &canStop, bool &hasAttacked) |
| HexDirection & | getPosDir (const MapCoordinate3D &pos) |
| int & | getPosHHop (const MapCoordinate3D &pos) |
| DistanceType | dist (const MapCoordinate3D &a, const MapCoordinate3D &b) |
| DistanceType | dist (const MapCoordinate3D &a, const vector< MapCoordinate3D > &b) |
| bool | get_first (Container &v, Node &n) |
| void | nodeVisited (const Node &n, HexDirection direc, Container &open, int prevHeight=-10, int heightChangeDist=0) |
Protected Attributes | |
| OperationLimiter * | operationLimiter |
| int | MAXIMUM_PATH_LENGTH |
| GameMap * | tempsMarked |
| Path * | _path |
| Vehicle * | veh |
| GameMap * | actmap |
| float | vehicleSpeedFactor [8] |
| float | maxVehicleSpeedFactor |
| bool | markTemps |
| WindMovement * | wind |
| HexDirection * | posDirs |
| int * | posHHops |
| int * | fieldAccess |
Classes | |
| class | Container |
| struct | Node |
| class | OperationLimiter |
| class | PathPoint |
Definition at line 98 of file astar2.h.
| typedef float AStar3D::DistanceType |
| typedef vector<PathPoint> AStar3D::Path |
| AStar3D::AStar3D | ( | GameMap * | actmap, | |
| Vehicle * | veh, | |||
| bool | markTemps_ = true, |
|||
| int | maxDistance = maxint | |||
| ) |
Definition at line 429 of file astar2.cpp.
References _path, actmap, chfliegend, chhochfliegend, chtieffliegend, DirNone, fieldAccess, MapCoordinate3D::getNumericalHeight(), Vehicle::getPosition(), ContainerBaseType::height, longestPath, markTemps, max(), MAXIMUM_PATH_LENGTH, Vehicle::maxMovement(), maxVehicleSpeedFactor, VehicleType::movement, posDirs, posHHops, tempsMarked, Vehicle::typ, veh, vehicleSpeedFactor, GameMap::weather, wind, GameMap::Weather::windSpeed, GameMap::xsize, and GameMap::ysize.
| AStar3D::~AStar3D | ( | ) | [virtual] |
Definition at line 483 of file astar2.cpp.
References GameMap::cleartemps(), fieldAccess, posDirs, posHHops, tempsMarked, and wind.
| AStar3D::DistanceType AStar3D::getMoveCost | ( | const MapCoordinate3D & | start, | |
| const MapCoordinate3D & | dest, | |||
| const Vehicle * | vehicle, | |||
| bool & | canStop, | |||
| bool & | hasAttacked | |||
| ) | [protected, virtual] |
Reimplemented in StratAStar3D, AntiMineAStar3D, and HiddenAStar3D.
Definition at line 529 of file astar2.cpp.
References actmap, calcMoveMalus(), fieldAccessible(), MapCoordinate3D::getBitmappedHeight(), GameMap::getField(), MapCoordinate3D::getNumericalHeight(), longestPath, VehicleType::movement, Vehicle::typ, veh, vehicleSpeedFactor, and wind.
Referenced by findPath(), HiddenAStar3D::getMoveCost(), AntiMineAStar3D::getMoveCost(), and StratAStar3D::getMoveCost().
| HexDirection& AStar3D::getPosDir | ( | const MapCoordinate3D & | pos | ) | [inline, protected] |
Definition at line 158 of file astar2.h.
References actmap, MapCoordinate3D::getNumericalHeight(), posDirs, MapCoordinate::x, GameMap::xsize, and MapCoordinate::y.
Referenced by findPath(), and nodeVisited().
| int& AStar3D::getPosHHop | ( | const MapCoordinate3D & | pos | ) | [inline, protected] |
Definition at line 159 of file astar2.h.
References actmap, MapCoordinate3D::getNumericalHeight(), posHHops, MapCoordinate::x, GameMap::xsize, and MapCoordinate::y.
Referenced by findPath(), and nodeVisited().
| AStar3D::DistanceType AStar3D::dist | ( | const MapCoordinate3D & | a, | |
| const MapCoordinate3D & | b | |||
| ) | [protected] |
Definition at line 498 of file astar2.cpp.
References beeline(), chfliegend, chhochfliegend, chtieffliegend, MapCoordinate3D::getBitmappedHeight(), MapCoordinate3D::getNumericalHeight(), longestPath, minmalq, MapCoordinate::valid(), wind, and windbeeline().
Referenced by dist(), and findPath().
| AStar3D::DistanceType AStar3D::dist | ( | const MapCoordinate3D & | a, | |
| const vector< MapCoordinate3D > & | b | |||
| ) | [protected] |
Definition at line 515 of file astar2.cpp.
References dist(), longestPath, and maxVehicleSpeedFactor.
| void AStar3D::nodeVisited | ( | const Node & | n, | |
| HexDirection | direc, | |||
| Container & | open, | |||
| int | prevHeight = -10, |
|||
| int | heightChangeDist = 0 | |||
| ) | [protected] |
Definition at line 570 of file astar2.cpp.
References AStar3D::Container::add(), DirNone, getPosDir(), getPosHHop(), AStar3D::Node::gval, AStar3D::Node::h, longestPath, MAXIMUM_PATH_LENGTH, ReverseDirection(), and AStar3D::Container::update().
Referenced by findPath().
| void AStar3D::registerOperationLimiter | ( | OperationLimiter * | ol | ) | [inline] |
the search can be restricted to certain operations
Definition at line 201 of file astar2.h.
References operationLimiter.
| void AStar3D::findPath | ( | const MapCoordinate3D & | A, | |
| const vector< MapCoordinate3D > & | B, | |||
| Path & | path | |||
| ) |
searches for a path from A to B and stores it in path
Definition at line 619 of file astar2.cpp.
References _path, actmap, AStar3D::Container::add(), AStar3D::OperationLimiter::allowDocking(), AStar3D::OperationLimiter::allowHeightChange(), AStar3D::OperationLimiter::allowLeavingContainer(), AStar3D::OperationLimiter::allowMovement(), MapField::building, AStar3D::Node::canStop, cbbuildingentry, cgp_movefrominvalidfields, ContainerBaseType::TransportationIO::disableAttack, dist(), AStar3D::Container::empty(), AStar3D::Node::enterHeight, fatalError(), fieldAccessible(), fieldVisited(), MapCoordinate3D::getBitmappedHeight(), MapField::getContainer(), getDirectionOrder(), GameMap::getField(), AStar3D::Container::getFirst(), GameMap::getgameparameter(), getMoveCost(), getNeighbouringFieldCoordinate(), getnextfield(), MapCoordinate3D::getNumericalHeight(), ContainerBase::getOwner(), getPosDir(), getPosHHop(), getTerrainBitType(), AStar3D::Node::gval, AStar3D::Node::h, AStar3D::Node::hasAttacked, AStar3D::Node::hval, longestPath, MAXIMUM_PATH_LENGTH, maxmalq, N, nodeVisited(), ContainerBaseType::OnlyMoveToAndFromTransports, operationLimiter, MapCoordinate3D::setnum(), MapField::unitHere(), veh, MapField::vehicle, ContainerBase::vehicleDocking(), ContainerBase::vehicleUnloadable(), ContainerBase::vehicleUnloadSystem(), visited, MapCoordinate::x, GameMap::xsize, MapCoordinate::y, and GameMap::ysize.
Referenced by MoveUnitCommand::calcPath(), findAllAccessibleFields(), findPath(), PathFinder::getMovementFields(), and MoveUnitCommand::isFieldReachable3D().
| void AStar3D::findPath | ( | Path & | path, | |
| const MapCoordinate3D & | dest | |||
| ) |
searches for a path from the unit's current position to dest and stores it in path
Definition at line 899 of file astar2.cpp.
References findPath(), Vehicle::getPosition3D(), and veh.
| void AStar3D::findPath | ( | Path & | path, | |
| const vector< MapCoordinate3D > & | dest | |||
| ) |
searches for a path from the units current position to one of the dest fields and stores it in path
Definition at line 906 of file astar2.cpp.
References findPath(), Vehicle::getPosition3D(), and veh.
| void AStar3D::findAllAccessibleFields | ( | vector< MapCoordinate3D > * | path = NULL |
) |
searches for all fields that are within the range of maxDist and marks them.
On each field one bit for each level of height will be set. The Destructor removes all marks.
| path | if non-null, all fields will be stored there |
Definition at line 912 of file astar2.cpp.
References MapField::a, actmap, AStar3D::Container::begin(), GameMap::cleartemps(), AStar3D::Container::end(), findPath(), GameMap::getField(), getFieldAccess(), Vehicle::height, markTemps, tempsMarked, veh, visited, GameMap::xsize, and GameMap::ysize.
| int AStar3D::getDistance | ( | ) |
returns the distance of the last found path, or -1 on any error
| int AStar3D::getTravelTime | ( | ) |
returns the number of turns that the unit will need to travel along the last found path
| const AStar3D::Node * AStar3D::fieldVisited | ( | const MapCoordinate3D & | fld | ) |
checks weather the field fld was among the visited fields during the last search
Definition at line 935 of file astar2.cpp.
References AStar3D::Container::end(), AStar3D::Container::find(), and visited.
Referenced by findPath().
| int & AStar3D::getFieldAccess | ( | int | x, | |
| int | y | |||
| ) |
Definition at line 945 of file astar2.cpp.
References actmap, fieldAccess, and GameMap::xsize.
Referenced by findAllAccessibleFields().
| int & AStar3D::getFieldAccess | ( | const MapCoordinate & | mc | ) |
Definition at line 950 of file astar2.cpp.
References actmap, fieldAccess, MapCoordinate::x, GameMap::xsize, and MapCoordinate::y.
const AStar3D::DistanceType AStar3D::longestPath [static] |
Definition at line 101 of file astar2.h.
Referenced by AStar3D(), dist(), findPath(), getMoveCost(), nodeVisited(), AStar3D::Node::operator<(), and operator>().
OperationLimiter* AStar3D::operationLimiter [protected] |
int AStar3D::MAXIMUM_PATH_LENGTH [protected] |
GameMap* AStar3D::tempsMarked [protected] |
Definition at line 143 of file astar2.h.
Referenced by AStar3D(), findAllAccessibleFields(), and ~AStar3D().
Path* AStar3D::_path [protected] |
Vehicle* AStar3D::veh [protected] |
Definition at line 145 of file astar2.h.
Referenced by AStar3D(), findAllAccessibleFields(), findPath(), getMoveCost(), and PathFinder::getMovementFields().
GameMap* AStar3D::actmap [protected] |
Definition at line 146 of file astar2.h.
Referenced by AStar3D(), findAllAccessibleFields(), findPath(), getFieldAccess(), getMoveCost(), getPosDir(), and getPosHHop().
float AStar3D::vehicleSpeedFactor[8] [protected] |
float AStar3D::maxVehicleSpeedFactor [protected] |
bool AStar3D::markTemps [protected] |
WindMovement* AStar3D::wind [protected] |
Definition at line 150 of file astar2.h.
Referenced by AStar3D(), dist(), getMoveCost(), and ~AStar3D().
HexDirection* AStar3D::posDirs [protected] |
int* AStar3D::posHHops [protected] |
int* AStar3D::fieldAccess [protected] |
the reachable fields
Definition at line 186 of file astar2.h.
Referenced by fieldVisited(), findAllAccessibleFields(), findPath(), and PathFinder::getMovementFields().
1.5.1