diff options
Diffstat (limited to 'src/path_finder.cpp')
-rw-r--r-- | src/path_finder.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/path_finder.cpp b/src/path_finder.cpp index 4ace89d..3d97df7 100644 --- a/src/path_finder.cpp +++ b/src/path_finder.cpp @@ -13,13 +13,14 @@ path_finder_t::~path_finder_t() delete nodes; } -void path_finder_t::setup_nodes(v2f_t src_, v2f_t dst_) +void path_finder_t::setup_nodes(v2f_t src_, v2f_t dst_, cflags_t cflags_) { rectf_t src_margin, dst_margin, bounds; tile_index_t end; src = src_; dst = dst_; + cflags = cflags_; tile_center = v2f_t(0.5, 0.5); shortest_dist = INFINITY; @@ -41,13 +42,16 @@ void path_finder_t::setup_nodes(v2f_t src_, v2f_t dst_) nodes[i].dist = INFINITY; } -void path_finder_t::eliminate_nodes(rectf_t bounds) +void path_finder_t::eliminate_nodes(cmodel_t cmodel) { rect_t<coord_t, 2> index_bounds; tile_index_t index; - index_bounds[0] = tile_index_t(bounds[0].floor()) - base; - index_bounds[1] = tile_index_t(bounds[1].ceil()) - base; + if (!(cmodel.cflags & cflags)) + return; + + index_bounds[0] = tile_index_t(cmodel.bounds[0].floor()) - base; + index_bounds[1] = tile_index_t(cmodel.bounds[1].ceil()) - base; for (index[1] = index_bounds[0][1]; index[1] <= index_bounds[1][1]; index[1]++) for (index[0] = index_bounds[0][0]; index[0] <= index_bounds[1][0]; index[0]++) { |