19 #ifndef OPENXCOM_PATHFINDING_H
20 #define OPENXCOM_PATHFINDING_H
24 #include "PathfindingNode.h"
25 #include "../Ruleset/MapData.h"
30 class SavedBattleGame;
41 std::vector<PathfindingNode> _nodes;
48 MovementType _movementType;
52 bool isBlocked(
Tile *tile,
const int part,
BattleUnit *missileTarget,
int bigWallExclusion = -1);
54 bool bresenhamPath(
const Position& origin,
const Position& target,
BattleUnit *missileTarget,
bool sneak =
false,
int maxTUCost = 1000);
56 bool aStarPath(
const Position& origin,
const Position& target,
BattleUnit *missileTarget,
bool sneak =
false,
int maxTUCost = 1000);
58 bool canFallDown(
Tile *destinationTile);
60 bool canFallDown(
Tile *destinationTile,
int size);
61 std::vector<int> _path;
66 bool isBlocked(
Tile *startTile,
Tile *endTile,
const int direction,
BattleUnit *missileTarget);
67 static const int DIR_UP = 8;
68 static const int DIR_DOWN = 9;
69 enum bigWallTypes{ BLOCK = 1, BIGWALLNESW, BIGWALLNWSE, BIGWALLWEST, BIGWALLNORTH, BIGWALLEAST, BIGWALLSOUTH, BIGWALLEASTANDSOUTH};
70 static const int O_BIGWALL = -1;
108 const std::vector<int> &
getPath();
static void directionToVector(const int direction, Position *vector)
Converts direction to a vector.
Definition: Pathfinding.cpp:488
void calculate(BattleUnit *unit, Position endPosition, BattleUnit *missileTarget=0, int maxTUCost=1000)
Calculates the shortest path.
Definition: Pathfinding.cpp:81
int dequeuePath()
Dequeues a direction.
Definition: Pathfinding.cpp:532
Pathfinding(SavedBattleGame *save)
Creates a new Pathfinding class.
Definition: Pathfinding.cpp:42
const std::vector< int > & getPath()
Gets a reference to the path.
Definition: Pathfinding.cpp:1174
bool isModifierUsed() const
Gets the modifier setting.
Definition: Pathfinding.cpp:1165
std::vector< int > copyPath() const
Makes a copy to the path.
Definition: Pathfinding.cpp:1183
int getStartDirection()
Checks whether a path is ready and gives the first direction.
Definition: Pathfinding.cpp:522
std::vector< int > findReachable(BattleUnit *unit, int tuMax)
Gets all reachable tiles, based on cost.
Definition: Pathfinding.cpp:1074
static void vectorToDirection(const Position &vector, int &dir)
Converts a vector to a direction.
Definition: Pathfinding.cpp:503
bool isPathPreviewed() const
Gets the path preview setting.
Definition: Pathfinding.cpp:1139
bool removePreview()
Removes the path preview.
Definition: Pathfinding.cpp:927
int getTUCost(const Position &startPosition, const 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:250
bool isOnStairs(const Position &startPosition, const Position &endPosition)
Determines whether the unit is going up a stairs.
Definition: Pathfinding.cpp:765
Basic element of which a battle map is build.
Definition: Tile.h:43
A class that holds pathfinding info for a certain node on the map.
Definition: PathfindingNode.h:33
bool getStrafeMove() const
Gets the strafe move setting.
Definition: Pathfinding.cpp:1130
void setUnit(BattleUnit *unit)
Sets _unit in order to abuse low-level pathfinding functions from outside the class.
Definition: Pathfinding.cpp:1148
~Pathfinding()
Cleans up the Pathfinding.
Definition: Pathfinding.cpp:59
A utility class that calculates the shortest path between two points on the battlescape map...
Definition: Pathfinding.h:37
The battlescape data that gets written to disk when the game is saved.
Definition: SavedBattleGame.h:50
void abortPath()
Aborts the current path.
Definition: Pathfinding.cpp:543
Easy handling of X-Y-Z coordinates.
Definition: Position.h:30
bool previewPath(bool bRemove=false)
Previews the path.
Definition: Pathfinding.cpp:839
bool validateUpDown(BattleUnit *bu, Position startPosition, const int direction)
Checks, for the up/down button, if the movement is valid.
Definition: Pathfinding.cpp:805
Represents a moving unit in the battlescape, player controlled or AI controlled it holds info about i...
Definition: BattleUnit.h:58
int getTotalTUCost() const
Gets _totalTUCost; finds out whether we can hike somewhere in this turn or not.
Definition: Pathfinding.h:102