diff options
author | worktycho <work.tycho@gmail.com> | 2015-05-20 14:06:51 +0200 |
---|---|---|
committer | worktycho <work.tycho@gmail.com> | 2015-05-20 14:06:51 +0200 |
commit | eaedd5f19da3f6fa59f3d11d464ec567622433bd (patch) | |
tree | 20c8bc39184f3e22a663717b6b7fcd3e62235164 /src/Mobs/Path.h | |
parent | Merge pull request #2076 from mc-server/Cert-disable (diff) | |
parent | newlines (diff) | |
download | cuberite-eaedd5f19da3f6fa59f3d11d464ec567622433bd.tar cuberite-eaedd5f19da3f6fa59f3d11d464ec567622433bd.tar.gz cuberite-eaedd5f19da3f6fa59f3d11d464ec567622433bd.tar.bz2 cuberite-eaedd5f19da3f6fa59f3d11d464ec567622433bd.tar.lz cuberite-eaedd5f19da3f6fa59f3d11d464ec567622433bd.tar.xz cuberite-eaedd5f19da3f6fa59f3d11d464ec567622433bd.tar.zst cuberite-eaedd5f19da3f6fa59f3d11d464ec567622433bd.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Path.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h index 7a4182f17..acc56ef2d 100644 --- a/src/Mobs/Path.h +++ b/src/Mobs/Path.h @@ -24,13 +24,30 @@ 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: bool operator()(cPathCell * & a_V1, cPathCell * & a_V2); }; + + + + class cPath { public: @@ -144,7 +161,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; |