summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Path.h
diff options
context:
space:
mode:
authorwiseoldman95 <softwatt@gmx.com>2015-05-01 17:53:24 +0200
committerwiseoldman95 <softwatt@gmx.com>2015-05-02 13:16:16 +0200
commit16b6fc9b5d59ac795e139b2a597da97953690d82 (patch)
treead50db2fa44bd7fed1bbf5251eac78d4b076b483 /src/Mobs/Path.h
parentMerge pull request #1920 from wiseoldman95/SquashedPathFinder (diff)
downloadcuberite-16b6fc9b5d59ac795e139b2a597da97953690d82.tar
cuberite-16b6fc9b5d59ac795e139b2a597da97953690d82.tar.gz
cuberite-16b6fc9b5d59ac795e139b2a597da97953690d82.tar.bz2
cuberite-16b6fc9b5d59ac795e139b2a597da97953690d82.tar.lz
cuberite-16b6fc9b5d59ac795e139b2a597da97953690d82.tar.xz
cuberite-16b6fc9b5d59ac795e139b2a597da97953690d82.tar.zst
cuberite-16b6fc9b5d59ac795e139b2a597da97953690d82.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Path.h27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h
index 05fd59155..9927d0a34 100644
--- a/src/Mobs/Path.h
+++ b/src/Mobs/Path.h
@@ -18,12 +18,8 @@ Put this in your .cpp:
#include <unordered_map>
-/* MCServer forward declarations */
-#ifndef COMPILING_PATHFIND_DEBUGGER
-
-// fwd: cChunkMap.h
-typedef cItemCallback<cChunk> cChunkCallback;
-#endif
+//fwd: ../Chunk.h
+class cChunk;
/* Various little structs and classes */
enum class ePathFinderStatus {CALCULATING, PATH_FOUND, PATH_NOT_FOUND};
@@ -35,9 +31,6 @@ public:
};
class cPath
-#ifndef COMPILING_PATHFIND_DEBUGGER
-: public cChunkCallback
-#endif
{
public:
/** Creates a pathfinder instance. A Mob will probably need a single pathfinder instance for its entire life.
@@ -59,7 +52,7 @@ public:
@param a_EndingPoint "The block where the Zombie's knees want to be".
@param a_MaxSteps The maximum steps before giving up. */
cPath(
- cWorld * a_World,
+ cChunk * a_Chunk,
const Vector3d & a_StartingPoint, const Vector3d & a_EndingPoint, int a_MaxSteps,
double a_BoundingBoxWidth = 1, double a_BoundingBoxHeight = 2,
int a_MaxUp = 1, int a_MaxDown = 1
@@ -69,7 +62,7 @@ public:
~cPath();
/** Performs part of the path calculation and returns true if the path computation has finished. */
- ePathFinderStatus Step();
+ ePathFinderStatus Step(cChunk * a_Chunk);
/* Point retrieval functions, inlined for performance. */
/** Returns the next point in the path. */
@@ -147,15 +140,9 @@ private:
std::vector<Vector3d> m_PathPoints;
void AddPoint(Vector3d a_Vector);
- /* Interfacing with MCServer's world */
- cWorld * m_World;
- #ifndef COMPILING_PATHFIND_DEBUGGER
- Vector3d m_Item_CurrentBlock; // Read by Item();, it's the only way to "pass it" parameters
-protected:
- virtual bool Item(cChunk * a_Chunk) override;
-
- /* Interfacing with Irrlicht, has nothing to do with MCServer*/
- #else
+ /* Interfacing with the world */
+ cChunk * m_Chunk; // Only valid inside Step()!
+ #ifdef COMPILING_PATHFIND_DEBUGGER
#include "../path_irrlicht.cpp"
#endif
};