A* implementation
Working except for end of path endless loop (0,0 point appearing in paths for no reason?) Commit mainly because the HDD is on the verge of dying
This commit is contained in:
parent
e0443585d0
commit
4b39ac42fd
9 changed files with 181 additions and 29 deletions
13
src/Utils.h
13
src/Utils.h
|
@ -12,10 +12,12 @@
|
|||
|
||||
namespace pro_maat
|
||||
{
|
||||
// Used with positions on the map grid
|
||||
using GridPos = std::pair<uint8_t,uint8_t>;
|
||||
// Used as the base of all grid based computations
|
||||
using GridUnit = int16_t;
|
||||
// Used when dealing with the grid representation of the map
|
||||
using GridPos = std::pair<GridUnit,GridUnit>;
|
||||
|
||||
static constexpr uint8_t pixelsPerUnit = 50;
|
||||
static constexpr uint8_t pixelsPerUnit = 30;
|
||||
static constexpr char levelFolder[] = "resources/";
|
||||
static constexpr char textureFolder[] = "resources/";
|
||||
static constexpr char fontFolder[] = "resources/";
|
||||
|
@ -23,8 +25,9 @@ static constexpr char fontFolder[] = "resources/";
|
|||
void errorWindow(const std::string& error);
|
||||
|
||||
// Good heuristic on 4-way grids
|
||||
float manhattanDistance(pro_maat::GridPos leftHandSide, pro_maat::GridPos rightHandSide);
|
||||
|
||||
float manhattanDistance(const GridPos& leftHandSide, const GridPos& rightHandSide);
|
||||
/// Gets the 4 cardinal neighbours on the grid with edge checking
|
||||
const std::vector<pro_maat::GridPos> getNeighbours(const GridPos& origin, const GridPos& gridSize);
|
||||
}
|
||||
|
||||
#endif //PROJECT_MAAT_UTILS_H
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue