/******************************************************************************/
#include "pathfinder.h"
+#include "environment.h"
+#include "map.h"
+#include "log.h"
#ifdef PATHFINDER_DEBUG
#include <iomanip>
//check parameters
if (env == 0) {
- std::cout << "missing environment pointer" << std::endl;
+ ERROR_TARGET << "missing environment pointer" << std::endl;
return retval;
}
//build data map
if (!build_costmap()) {
- std::cout << "failed to build costmap" << std::endl;
+ ERROR_TARGET << "failed to build costmap" << std::endl;
return retval;
}
#ifdef PATHFINDER_DEBUG
path_gridnode& endpos = getIndexElement(EndIndex);
if (!startpos.valid) {
- std::cout << "invalid startpos" <<
+ ERROR_TARGET << "invalid startpos" <<
"Index: " << PPOS(StartIndex) <<
"Realpos: " << PPOS(getRealPos(StartIndex)) << std::endl;
return retval;
}
if (!endpos.valid) {
- std::cout << "invalid stoppos" <<
+ ERROR_TARGET << "invalid stoppos" <<
"Index: " << PPOS(EndIndex) <<
"Realpos: " << PPOS(getRealPos(EndIndex)) << std::endl;
return retval;
update_cost_retval = update_cost_heuristic(StartIndex,v3s16(0,0,0),0,0);
break;
default:
- std::cout << "missing algorithm"<< std::endl;
+ ERROR_TARGET << "missing algorithm"<< std::endl;
break;
}
#ifdef PATHFINDER_DEBUG
print_pathlen();
#endif
- std::cout << "failed to update cost map"<< std::endl;
+ ERROR_TARGET << "failed to update cost map"<< std::endl;
}
" out of range (" << m_limits.X.max << "," <<
m_limits.Y.max << "," << m_limits.Z.max
<<")" << std::endl);
+ direction = get_dir_heuristic(directions,g_pos);
continue;
}
if (!g_pos2.valid) {
VERBOSE_TARGET << LVL "Pathfinder: no data for new position: "
<< PPOS(ipos2) << std::endl;
+ direction = get_dir_heuristic(directions,g_pos);
continue;
}
/******************************************************************************/
void pathfinder::build_path(std::vector<v3s16>& path,v3s16 pos, int level) {
level ++;
- if (level > 1000) {
+ if (level > 700) {
ERROR_TARGET
<< LVL "Pathfinder: path is too long aborting" << std::endl;
return;