diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2017-11-06 19:58:41 +0000 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2017-11-06 19:58:41 +0000 |
commit | bdd1b10cb8d6c405de58031e1de57c7f2b24225f (patch) | |
tree | 93f08e73ca4b34b23e8bd1fbde422848eba9d7bb /src/path_finder.cpp | |
parent | 6a82d04e2b5edffc32df44aa46d6cf60428c7b44 (diff) |
Introduce cmodels and cflags.
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]++) { |