diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2017-11-06 20:17:58 +0000 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2017-11-06 20:18:31 +0000 |
commit | 6ab51bfb002af08da74a693f386c4154d2c4108a (patch) | |
tree | ee1954051f88f2cacd6470ab4418bef468b91735 /src/world.cpp | |
parent | bdd1b10cb8d6c405de58031e1de57c7f2b24225f (diff) |
More support for cflags.
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
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<sector_t*> world_t::get_sectors(rectf_t rect) return list; } -std::list<entity_t*> world_t::get_entities(rectf_t rect) +std::list<entity_t*> world_t::get_entities(rectf_t rect, cflags_t cflags) { static size_t cookie = 0; std::list<entity_t*> list; @@ -181,10 +181,13 @@ std::list<entity_t*> 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); } |