summaryrefslogtreecommitdiff
path: root/src/world.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/world.cpp')
-rw-r--r--src/world.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/world.cpp b/src/world.cpp
index ef056db..3d21789 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -107,12 +107,25 @@ bool world_t::find_path(v2f_t src, v2f_t dst, cmodel_t *cmodel, entity_t *ignore
finder.eliminate_nodes(combined);
}
- bounds = rectf_t(src, dst).norm();
+ bounds = finder.bounds;
+ bounds[0] -= cmodel_dims / 2;
+ bounds[1] += cmodel_dims / 2;
- for (entity_t *ent : get_entities(bounds, cmodel->cflags))
- if (ent != ignore)
- finder.eliminate_nodes(ent->cmodel.bounds);
+ for (entity_t *ent : get_entities(bounds, cmodel->cflags)) {
+ v2f_t center;
+ v2f_t combined_dims;
+ rectf_t combined;
+
+ if (ent == ignore)
+ continue;
+ center = ent->cmodel.bounds.center();
+ combined_dims = ent->cmodel.bounds.dims() + cmodel_dims;
+ combined[0] = center - combined_dims / 2;
+ combined[1] = center + combined_dims / 2;
+
+ finder.eliminate_nodes(combined);
+ }
if (!finder.find())
return false;