From 6ab51bfb002af08da74a693f386c4154d2c4108a Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Mon, 6 Nov 2017 20:17:58 +0000 Subject: More support for cflags. --- src/world.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/world.cpp') diff --git a/src/world.cpp b/src/world.cpp index d9789ad..ab3ef92 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -99,9 +99,9 @@ bool world_t::find_path(v2f_t src, v2f_t dst, cmodel_t *cmodel, entity_t *ignore bounds = rectf_t(src, dst).norm(); - for (entity_t *ent : get_entities(bounds)) + for (entity_t *ent : get_entities(bounds, cmodel->cflags)) if (ent != ignore) - finder.eliminate_nodes(ent->cmodel); + finder.eliminate_nodes(ent->cmodel.bounds); if (!finder.find()) return false; @@ -169,7 +169,7 @@ std::list world_t::get_sectors(rectf_t rect) return list; } -std::list world_t::get_entities(rectf_t rect) +std::list world_t::get_entities(rectf_t rect, cflags_t cflags) { static size_t cookie = 0; std::list list; @@ -181,10 +181,13 @@ std::list world_t::get_entities(rectf_t rect) if (ent->cookie == cookie) continue; - if (!(rect && ent->cmodel.bounds)) + ent->cookie = cookie; + + if (!(ent->cmodel.cflags & cflags)) continue; - ent->cookie = cookie; + if (!(rect && ent->cmodel.bounds)) + continue; list.push_back(ent); } -- cgit