diff options
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/world.cpp b/src/world.cpp index 307374c..895eb0f 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -66,7 +66,6 @@ bool world_t::find_path(v2f_t src, v2f_t dst, rectf_t size, std::list<v2f_t> *path) { path_finder_t finder; - bool rv; finder.setup_nodes(src, dst); @@ -79,24 +78,11 @@ bool world_t::find_path(v2f_t src, v2f_t dst, rectf_t size, node->accessible = (get_tile(index)->type >= 1); } - finder.find(); - rv = finder.export_path(path); + if (!finder.find()) + return false; - debug.clear(); - - for (size_t y = 0; y < finder.height; y++) - for (size_t x = 0; x < finder.width; x++) { - path_node_t *node = finder.nodes + y * finder.width + x; - std::stringstream ss; - - ss << "LT " << tile_index_t(x, y) << "\n"; - ss << " T " << finder.base + tile_index_t(x, y) << "\n"; - ss << " d " << node->dist; - - debug.push_back((debug_t){finder.base + tile_index_t(x, y), ss.str()}); - } - - return rv; + finder.export_path(path); + return true; } sector_t *world_t::get_sector(sector_index_t index) |