diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2015-07-11 21:40:03 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2015-08-22 18:06:08 +0200 |
commit | baf3a0780489590d9433d115ee51c02a2ecf3e57 (patch) | |
tree | e0ef74726a9f37462fa941c38cfea0aa550b19fe /src/Mobs/Path.cpp | |
parent | Cast UINT to WORD to appease warning (diff) | |
download | cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar.gz cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar.bz2 cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar.lz cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar.xz cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.tar.zst cuberite-baf3a0780489590d9433d115ee51c02a2ecf3e57.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Mobs/Path.cpp | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/src/Mobs/Path.cpp b/src/Mobs/Path.cpp index dd908c86b..43b29f1d0 100644 --- a/src/Mobs/Path.cpp +++ b/src/Mobs/Path.cpp @@ -17,9 +17,6 @@ - - - bool compareHeuristics::operator()(cPathCell * & a_Cell1, cPathCell * & a_Cell2) { return a_Cell1->m_F > a_Cell2->m_F; @@ -36,7 +33,7 @@ cPath::cPath( double a_BoundingBoxWidth, double a_BoundingBoxHeight, int a_MaxUp, int a_MaxDown ) : - + m_StepsLeft(a_MaxSteps), m_CurrentPoint(0), // GetNextPoint increments this to 1, but that's fine, since the first cell is always a_StartingPoint m_Chunk(&a_Chunk), m_BadChunkFound(false) @@ -67,22 +64,8 @@ cPath::cPath( m_NearestPointToTarget = GetCell(m_Source); m_Status = ePathFinderStatus::CALCULATING; - m_StepsLeft = a_MaxSteps; - - ProcessCell(GetCell(a_StartingPoint), nullptr, 0); - m_Chunk = nullptr; -} - - - - -cPath::~cPath() -{ - if (m_Status == ePathFinderStatus::CALCULATING) - { - FinishCalculation(); - } + ProcessCell(GetCell(m_Source), nullptr, 0); } @@ -113,7 +96,7 @@ ePathFinderStatus cPath::Step(cChunk & a_Chunk) int i; for (i = 0; i < CALCULATIONS_PER_STEP; ++i) { - if (Step_Internal()) // Step_Internal returns true when no more calculation is needed. + if (StepOnce()) // StepOnce returns true when no more calculation is needed. { break; // if we're here, m_Status must have changed either to PATH_FOUND or PATH_NOT_FOUND. } @@ -179,7 +162,7 @@ bool cPath::IsSolid(const Vector3i & a_Location) -bool cPath::Step_Internal() +bool cPath::StepOnce() { cPathCell * CurrentCell = OpenListPop(); |