Mercurial > fife-parpg
changeset 295:faabfaf25f15
Removed the deletion of the search space from the the RoutePatherSearch class. This will fix the path finding so it now will calculate paths correctly. It should not be deleting the search space because it does not own it, it is only using it for calculations. Need to investigate further as to why the memory consumption continually increases when running UH. Also removed the need to store a local pointer in RoutePatherSearch to the singleton instance of a Heuristic, this will eliminate the possibly of having a dangling pointer or deleting something that it shouldn't.
author | vtchill@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 03 Jul 2009 05:11:54 +0000 |
parents | 7416088ab191 |
children | 9326ed8ffd77 |
files | engine/core/pathfinder/routepather/routepathersearch.cpp engine/core/pathfinder/routepather/routepathersearch.h |
diffstat | 2 files changed, 2 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/engine/core/pathfinder/routepather/routepathersearch.cpp Thu Jul 02 02:14:12 2009 +0000 +++ b/engine/core/pathfinder/routepather/routepathersearch.cpp Fri Jul 03 05:11:54 2009 +0000 @@ -48,15 +48,10 @@ m_spt.resize(max_index + 1, -1); m_sf.resize(max_index + 1, -1); m_gCosts.resize(max_index + 1, 0.0f); - m_heuristic = Heuristic::getHeuristic(searchSpace->getLayer()->getCellGrid()->getType()); - // m_to = to; - // m_from = from; - // m_sessionId = session_id; - // m_searchspace = searchSpace; } RoutePatherSearch::~RoutePatherSearch(){ - delete m_searchspace; + } void RoutePatherSearch::updateSearch() { @@ -90,7 +85,7 @@ continue; } - float hCost = m_heuristic->calculate((*i), destCoord); + float hCost = Heuristic::getHeuristic(m_searchspace->getLayer()->getCellGrid()->getType())->calculate((*i), destCoord); float gCost = m_gCosts[m_next] + loc.getLayer()->getCellGrid()->getAdjacentCost(nextCoord, (*i)); if(m_sf[adjacentInt] == -1) { m_sortedfrontier.pushElement(PriorityQueue<int, float>::value_type(adjacentInt, gCost + hCost));
--- a/engine/core/pathfinder/routepather/routepathersearch.h Thu Jul 02 02:14:12 2009 +0000 +++ b/engine/core/pathfinder/routepather/routepathersearch.h Fri Jul 03 05:11:54 2009 +0000 @@ -113,8 +113,6 @@ //An enumeration of the searches current status. SearchStatus m_status; - //The class to use to calculate the heuristic value. - Heuristic* m_heuristic; //The destination coordinate as an int. int m_destCoordInt; //The start coordinate as an int.