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

Public Types | |
| typedef vector< MapCoordinate > | Path |
| typedef std::vector< Node > | Container |
Public Member Functions | |
| AStar (GameMap *actmap, Vehicle *veh) | |
| int | dist (HexCoord a, HexCoord b) |
| void | get_first (Container &v, Node &n) |
| void | findPath (HexCoord A, HexCoord B, Path &path) |
| searches for a path from A to B and stores it in path | |
| void | findPath (Path &path, int x, int y) |
| searches for a path from the units current position to dest and stores it in path | |
| void | findAllAccessibleFields (int maxDist=maxint) |
| 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 | |
| bool | fieldVisited (int x, int y) |
| checks weather the field fld was among the visited fields during the last search | |
| virtual | ~AStar () |
Public Attributes | |
| greater< Node > | comp |
| Container | visited |
Protected Member Functions | |
| virtual int | getMoveCost (int x1, int y1, int x2, int y2, const Vehicle *vehicle) |
| returns the movement cost for the unit to travel from x1/y1 to x2/y2 | |
Protected Attributes | |
| int | MAXIMUM_PATH_LENGTH |
| GameMap * | tempsMarked |
| Path * | _path |
| Vehicle * | _veh |
| GameMap * | _actmap |
Classes | |
| struct | HexCoord |
| A hexagonal Coordinate. This structure is used instead of MapCoordinate to reduce the amount of modifications to Amits path finding code. More... | |
| struct | Node |
Definition at line 23 of file astar2.h.
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 63 of file astar2.cpp. References _actmap, _path, _veh, MAXIMUM_PATH_LENGTH, maxint, and tempsMarked. |
|
|
Definition at line 72 of file astar2.cpp. References GameMap::cleartemps(), and tempsMarked. |
|
||||||||||||
|
Definition at line 78 of file astar2.cpp. References beeline(), AStar::HexCoord::m, and AStar::HexCoord::n. Referenced by findPath(), getDistance(), and getTravelTime(). |
|
||||||||||||
|
checks weather the field fld was among the visited fields during the last search
Definition at line 315 of file astar2.cpp. References visited. |
|
|
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. Definition at line 325 of file astar2.cpp. References _actmap, GameMap::cleartemps(), findPath(), GameMap::getField(), MAXIMUM_PATH_LENGTH, tempsMarked, visited, GameMap::xsize, and GameMap::ysize. |
|
||||||||||||||||
|
searches for a path from the units current position to dest and stores it in path
Definition at line 340 of file astar2.cpp. References _veh, findPath(), Vehicle::xpos, and Vehicle::ypos. |
|
||||||||||||||||
|
searches for a path from A to B and stores it in path
Definition at line 139 of file astar2.cpp. References _actmap, _path, _veh, actmap, Vehicle::canMove(), GameMap::cleartemps(), comp, DirNone, dist(), GameMap::field, fieldAccessible(), get_first(), getfield(), GameMap::getField(), getMoveCost(), getnextfield(), AStar::Node::gval, AStar::Node::h, AStar::Node::hval, AStar::HexCoord::m, MAXIMUM_PATH_LENGTH, Vehicle::maxMovement(), N, AStar::HexCoord::n, random(), ReverseDirection(), tfield::temp3, visited, GameMap::xsize, and GameMap::ysize. Referenced by findAllAccessibleFields(), findPath(), and findPath(). |
|
||||||||||||
|
Definition at line 125 of file astar2.cpp. References comp. Referenced by findPath(). |
|
|
returns the distance of the last found path, or -1 on any error
Definition at line 291 of file astar2.cpp. References _actmap, _path, _veh, dist(), GameMap::getField(), tfield::getmovemalus(), Vehicletype::movemalustyp, and Vehicle::typ. Referenced by getTravelTime(). |
|
||||||||||||||||||||||||
|
returns the movement cost for the unit to travel from x1/y1 to x2/y2
Reimplemented in StratAStar, and HiddenAStar. Definition at line 105 of file astar2.cpp. References calcMoveMalus(), fieldAccessible(), getfield(), Vehicle::height, and MAXIMUM_PATH_LENGTH. Referenced by findPath(), HiddenAStar::getMoveCost(), and StratAStar::getMoveCost(). |
|
|
returns the number of turns that the unit will need to travel along the last found path
Definition at line 306 of file astar2.cpp. References _veh, dist(), getDistance(), Vehicle::height, log2(), Vehicletype::movement, and Vehicle::typ. |
|
|
Definition at line 32 of file astar2.h. Referenced by AStar(), findAllAccessibleFields(), findPath(), and getDistance(). |
|
|
Definition at line 30 of file astar2.h. Referenced by AStar(), findPath(), and getDistance(). |
|
|
Definition at line 31 of file astar2.h. Referenced by AStar(), findPath(), getDistance(), and getTravelTime(). |
|
|
Definition at line 59 of file astar2.h. Referenced by findPath(), and get_first(). |
|
|
Definition at line 28 of file astar2.h. Referenced by AStar(), findAllAccessibleFields(), findPath(), and getMoveCost(). |
|
|
Definition at line 29 of file astar2.h. Referenced by AStar(), findAllAccessibleFields(), and ~AStar(). |
|
|
Definition at line 64 of file astar2.h. Referenced by fieldVisited(), findAllAccessibleFields(), and findPath(). |
1.4.2