From bdd1b10cb8d6c405de58031e1de57c7f2b24225f Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Mon, 6 Nov 2017 19:58:41 +0000 Subject: Introduce cmodels and cflags. --- src/path_finder.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/path_finder.cpp') 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 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]++) { -- cgit