-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpathfinding.h
68 lines (53 loc) · 1.43 KB
/
pathfinding.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef PATHFINDING_H
#define PATHFINDING_H
#include "world.h"
#include "Model.h"
#include "tile_struct.h"
#include <iostream>
#include <set>
#include <vector>
#include <cstdlib>
#include <unordered_set>
class Pathfinding
{
public:
Pathfinding();
void findPath();
float getDistance(TileStruct tileA, TileStruct tileB);
void setup();
std::string serialize();
std::vector<TileStruct> getNeighbours(TileStruct currentTile);
bool targetReached(TileStruct tileToCheck);
void setModel(Model *model);
int setTargetWithCoords(int posX, int posY);
int setStartWithCoords(int posX, int posY);
int getTileIndex(int x, int y);
void setWeight(const float heuristicWeight);
std::vector<TileStruct> getPath();
private:
TileStruct startTile;
TileStruct endTile;
std::vector<std::shared_ptr<Tile>> tiles;
int nrOfTiles;
struct CompareCost {
bool operator()(TileStruct const& t1, TileStruct const& t2)
{
// return "true" if "t1" is ordered
// before "t2"
return t1.finalCost > t2.finalCost;
}
};
std::vector<TileStruct> path;
Model *model;
std::vector<TileStruct>gridOfTiles;
std::vector<std::shared_ptr<Enemy>> enemies;
float hCostWeight;
float sCostWeight;
float stepCost;
int gridWidth;
int gridHeight;
int realWidth;
int realHeight;
TileStruct currentTile;
};
#endif // PATHFINDING_H