22 #include "PathfindingNode.h" 23 #include "../Mod/MapData.h" 28 class SavedBattleGame;
39 std::vector<PathfindingNode> _nodes;
46 MovementType _movementType;
50 bool isBlocked(
Tile *tile,
const int part,
BattleUnit *missileTarget,
int bigWallExclusion = -1)
const;
56 bool canFallDown(
Tile *destinationTile)
const;
58 bool canFallDown(
Tile *destinationTile,
int size)
const;
59 std::vector<int> _path;
64 bool isBlocked(
Tile *startTile,
Tile *endTile,
const int direction,
BattleUnit *missileTarget);
65 static const int DIR_UP = 8;
66 static const int DIR_DOWN = 9;
67 enum bigWallTypes{ BLOCK = 1, BIGWALLNESW, BIGWALLNWSE, BIGWALLWEST, BIGWALLNORTH, BIGWALLEAST, BIGWALLSOUTH, BIGWALLEASTANDSOUTH, BIGWALLWESTANDNORTH};
68 static const int O_BIGWALL = -1;
109 const std::vector<int> &
getPath()
const;
int getStartDirection() const
Checks whether a path is ready and gives the first direction.
Definition: Pathfinding.cpp:549
void calculate(BattleUnit *unit, Position endPosition, BattleUnit *missileTarget=0, int maxTUCost=1000)
Calculates the shortest path.
Definition: Pathfinding.cpp:80
int getTUCost(Position startPosition, int direction, Position *endPosition, BattleUnit *unit, BattleUnit *target, bool missile)
Gets the TU cost to move from 1 tile to the other.
Definition: Pathfinding.cpp:258
int dequeuePath()
Dequeues a direction.
Definition: Pathfinding.cpp:559
int getTotalTUCost() const
Gets _totalTUCost; finds out whether we can hike somewhere in this turn or not.
Definition: Pathfinding.h:103
Pathfinding(SavedBattleGame *save)
Creates a new Pathfinding class.
Definition: Pathfinding.cpp:41
bool validateUpDown(BattleUnit *bu, const Position &startPosition, const int direction, bool missile=false) const
Checks, for the up/down button, if the movement is valid.
Definition: Pathfinding.cpp:870
bool isModifierUsed() const
Gets the modifier setting.
Definition: Pathfinding.cpp:1247
bool getStrafeMove() const
Gets the strafe move setting.
Definition: Pathfinding.cpp:1212
std::vector< int > findReachable(BattleUnit *unit, int tuMax)
Gets all reachable tiles, based on cost.
Definition: Pathfinding.cpp:1156
bool removePreview()
Removes the path preview.
Definition: Pathfinding.cpp:1009
bool isOnStairs(Position startPosition, Position endPosition) const
Determines whether the unit is going up a stairs.
Definition: Pathfinding.cpp:801
static void directionToVector(int direction, Position *vector)
Converts direction to a vector.
Definition: Pathfinding.cpp:515
Basic element of which a battle map is build.
Definition: Tile.h:42
std::vector< int > copyPath() const
Makes a copy to the path.
Definition: Pathfinding.cpp:1265
A class that holds pathfinding info for a certain node on the map.
Definition: PathfindingNode.h:31
void setUnit(BattleUnit *unit)
Sets _unit in order to abuse low-level pathfinding functions from outside the class.
Definition: Pathfinding.cpp:1230
const std::vector< int > & getPath() const
Gets a reference to the path.
Definition: Pathfinding.cpp:1256
~Pathfinding()
Cleans up the Pathfinding.
Definition: Pathfinding.cpp:58
A utility class that calculates the shortest path between two points on the battlescape map...
Definition: Pathfinding.h:35
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:47
void abortPath()
Aborts the current path.
Definition: Pathfinding.cpp:570
Easy handling of X-Y-Z coordinates.
Definition: Position.h:28
bool isPathPreviewed() const
Gets the path preview setting.
Definition: Pathfinding.cpp:1221
bool previewPath(bool bRemove=false)
Previews the path.
Definition: Pathfinding.cpp:916
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:59
Definition: BaseInfoState.cpp:40
static void vectorToDirection(Position vector, int &dir)
Converts a vector to a direction.
Definition: Pathfinding.cpp:530