summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Path.h
diff options
context:
space:
mode:
authorSafwatHalaby <SafwatHalaby@users.noreply.github.com>2015-05-19 20:07:05 +0200
committerSafwatHalaby <SafwatHalaby@users.noreply.github.com>2015-05-19 20:07:05 +0200
commit0741ad3526096ce0494a984c612b3dfca18fe6bb (patch)
treeeaa1a2daadd333c0b5f694d0437236d3510ff6c9 /src/Mobs/Path.h
parentMerge pull request #2049 from mc-server/sapling-probability (diff)
downloadcuberite-0741ad3526096ce0494a984c612b3dfca18fe6bb.tar
cuberite-0741ad3526096ce0494a984c612b3dfca18fe6bb.tar.gz
cuberite-0741ad3526096ce0494a984c612b3dfca18fe6bb.tar.bz2
cuberite-0741ad3526096ce0494a984c612b3dfca18fe6bb.tar.lz
cuberite-0741ad3526096ce0494a984c612b3dfca18fe6bb.tar.xz
cuberite-0741ad3526096ce0494a984c612b3dfca18fe6bb.tar.zst
cuberite-0741ad3526096ce0494a984c612b3dfca18fe6bb.zip
Diffstat (limited to 'src/Mobs/Path.h')
-rw-r--r--src/Mobs/Path.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h
index 7a4182f17..b3ad5ffd5 100644
--- a/src/Mobs/Path.h
+++ b/src/Mobs/Path.h
@@ -24,7 +24,15 @@ class cChunk;
/* Various little structs and classes */
enum class ePathFinderStatus {CALCULATING, PATH_FOUND, PATH_NOT_FOUND, NEARBY_FOUND};
-struct cPathCell; // Defined inside Path.cpp
+enum class eCellStatus {OPENLIST, CLOSEDLIST, NOLIST};
+struct cPathCell
+{
+ Vector3i m_Location; // Location of the cell in the world.
+ int m_F, m_G, m_H; // F, G, H as defined in regular A*.
+ eCellStatus m_Status; // Which list is the cell in? Either non, open, or closed.
+ cPathCell * m_Parent; // Cell's parent, as defined in regular A*.
+ bool m_IsSolid; // Is the cell an air or a solid? Partial solids are currently considered solids.
+};
class compareHeuristics
{
public:
@@ -144,7 +152,7 @@ private:
/* Pathfinding fields */
std::priority_queue<cPathCell *, std::vector<cPathCell *>, compareHeuristics> m_OpenList;
- std::unordered_map<Vector3i, UniquePtr<cPathCell>, VectorHasher> m_Map;
+ std::unordered_map<Vector3i, cPathCell, VectorHasher> m_Map;
Vector3i m_Destination;
Vector3i m_Source;
int m_StepsLeft;