comparison engine/core/pathfinder/routepather/routepather.cpp @ 310:8afb9b443f66

merged the pathfinding branch to trunk
author wenlin_fife@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 14 Aug 2009 00:00:58 +0000
parents 1465536aec94
children
comparison
equal deleted inserted replaced
309:f6b67f424ad2 310:8afb9b443f66
127 int ticksleft = m_maxticks; 127 int ticksleft = m_maxticks;
128 while(ticksleft >= 0) { 128 while(ticksleft >= 0) {
129 if(m_sessions.empty()) { 129 if(m_sessions.empty()) {
130 break; 130 break;
131 } 131 }
132 Search* priority_session = m_sessions.getPriorityElement().first; 132 RoutePatherSearch* priority_session = m_sessions.getPriorityElement().first;
133 if(!sessionIdValid(priority_session->getSessionId())) { 133 if(!sessionIdValid(priority_session->getSessionId())) {
134 delete priority_session; 134 delete priority_session;
135 m_sessions.popElement(); 135 m_sessions.popElement();
136 continue; 136 continue;
137 } 137 }
138 priority_session->updateSearch(); 138 priority_session->updateSearch();
139 if(priority_session->getSearchStatus() == Search::search_status_complete) { 139 if(priority_session->getSearchStatus() == RoutePatherSearch::search_status_complete) {
140 const int session_id = priority_session->getSessionId(); 140 const int session_id = priority_session->getSessionId();
141 Path newPath = priority_session->calcPath(); 141 Path newPath = priority_session->calcPath();
142 newPath.erase(newPath.begin()); 142 newPath.erase(newPath.begin());
143 m_paths.insert(PathMap::value_type(session_id, newPath)); 143 m_paths.insert(PathMap::value_type(session_id, newPath));
144 invalidateSessionId(session_id); 144 invalidateSessionId(session_id);
145 delete priority_session; 145 delete priority_session;
146 m_sessions.popElement(); 146 m_sessions.popElement();
147 } else if(priority_session->getSearchStatus() == Search::search_status_failed) { 147 } else if(priority_session->getSearchStatus() == RoutePatherSearch::search_status_failed) {
148 const int session_id = priority_session->getSessionId(); 148 const int session_id = priority_session->getSessionId();
149 invalidateSessionId(session_id); 149 invalidateSessionId(session_id);
150 delete priority_session; 150 delete priority_session;
151 m_sessions.popElement(); 151 m_sessions.popElement();
152 } 152 }