the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2#include "JavaIntHash.h"
3using namespace std;
4
5class LevelSource;
6
7class PathFinder
8{
9private:
10 LevelSource *level;
11
12 BinaryHeap openSet;
13
14 // 4J Jev, was a IntHashMap, thought this was close enough.
15 unordered_map<int, Node *, IntKeyHash, IntKeyEq> nodes;
16
17 NodeArray *neighbors;
18
19 bool canPassDoors;
20 bool canOpenDoors;
21 bool avoidWater;
22 bool canFloat;
23
24public:
25 PathFinder(LevelSource *level, bool canPassDoors, bool canOpenDoors, bool avoidWater, bool canFloat);
26 ~PathFinder();
27
28 Path *findPath(Entity *from, Entity *to, float maxDist);
29 Path *findPath(Entity *from, int x, int y, int z, float maxDist);
30
31private:
32 Path *findPath(Entity *e, double xt, double yt, double zt, float maxDist);
33
34 // function A*(start,goal)
35 Path *findPath(Entity *e, Node *from, Node *to, Node *size, float maxDist);
36 int getNeighbors(Entity *entity, Node *pos, Node *size, Node *target, float maxDist);
37 Node *getNode(Entity *entity, int x, int y, int z, Node *size, int jumpSize);
38 /*final*/ Node *getNode(int x, int y, int z);
39
40public:
41 static const int TYPE_TRAP = -4;
42 static const int TYPE_FENCE = -3;
43 static const int TYPE_LAVA = -2;
44 static const int TYPE_WATER = -1;
45 static const int TYPE_BLOCKED = 0;
46 static const int TYPE_OPEN = 1;
47 static const int TYPE_WALKABLE = 2;
48
49 int isFree(Entity *entity, int x, int y, int z, Node *size);
50 static int isFree(Entity *entity, int x, int y, int z, Node *size, bool avoidWater, bool canOpenDoors, bool canPassDoors);
51
52 // function reconstruct_path(came_from,current_node)
53 Path *reconstruct_path(Node *from, Node *to);
54};