# HG changeset patch # User vtchill@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1246597914 0 # Node ID faabfaf25f15e32688b627f1201c888c75098c4a # Parent 7416088ab19175ada80c058a4ea7e84ca860694a 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. diff -r 7416088ab191 -r faabfaf25f15 engine/core/pathfinder/routepather/routepathersearch.cpp --- 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::value_type(adjacentInt, gCost + hCost)); diff -r 7416088ab191 -r faabfaf25f15 engine/core/pathfinder/routepather/routepathersearch.h --- 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.