summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-05-15 19:54:45 +0200
committerworktycho <work.tycho@gmail.com>2015-05-15 19:54:45 +0200
commit5c3a85fba10e801c6553fa943fa85605bbcd4f41 (patch)
tree627e85f1869cdd56acc28f35c18a2bd7e561bcac /src
parentMerge pull request #2023 from SafwatHalaby/smartPointers (diff)
downloadcuberite-5c3a85fba10e801c6553fa943fa85605bbcd4f41.tar
cuberite-5c3a85fba10e801c6553fa943fa85605bbcd4f41.tar.gz
cuberite-5c3a85fba10e801c6553fa943fa85605bbcd4f41.tar.bz2
cuberite-5c3a85fba10e801c6553fa943fa85605bbcd4f41.tar.lz
cuberite-5c3a85fba10e801c6553fa943fa85605bbcd4f41.tar.xz
cuberite-5c3a85fba10e801c6553fa943fa85605bbcd4f41.tar.zst
cuberite-5c3a85fba10e801c6553fa943fa85605bbcd4f41.zip
Diffstat (limited to 'src')
-rw-r--r--src/Mobs/Path.cpp9
-rw-r--r--src/Mobs/Path.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/src/Mobs/Path.cpp b/src/Mobs/Path.cpp
index dd306af13..ba7d615ae 100644
--- a/src/Mobs/Path.cpp
+++ b/src/Mobs/Path.cpp
@@ -215,6 +215,11 @@ bool cPath::Step_Internal()
void cPath::FinishCalculation()
{
+ for (auto && pair : m_Map)
+ {
+ delete pair.second;
+ }
+
m_Map.clear();
m_OpenList = std::priority_queue<cPathCell *, std::vector<cPathCell *>, compareHeuristics>{};
}
@@ -343,7 +348,7 @@ cPathCell * cPath::GetCell(const Vector3i & a_Location)
{
Cell = new cPathCell();
Cell->m_Location = a_Location;
- m_Map[a_Location] = UniquePtr<cPathCell>(Cell);
+ m_Map[a_Location] = Cell;
Cell->m_IsSolid = IsSolid(a_Location);
Cell->m_Status = eCellStatus::NOLIST;
#ifdef COMPILING_PATHFIND_DEBUGGER
@@ -355,6 +360,6 @@ cPathCell * cPath::GetCell(const Vector3i & a_Location)
}
else
{
- return m_Map[a_Location].get();
+ return m_Map[a_Location];
}
}
diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h
index 008722d29..adae77984 100644
--- a/src/Mobs/Path.h
+++ b/src/Mobs/Path.h
@@ -131,7 +131,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;