summaryrefslogtreecommitdiffhomepage
path: root/src/path-search.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-09-11 18:02:50 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-09-11 18:02:50 +0200
commitf3f153ad0fb35aae25cdd7f7071d3bbd892db9f6 (patch)
tree318505efd1b3ba0ec20a75edaba62f518e8bfd2a /src/path-search.cpp
parenteb3f2bbd5b62063397d3ed4b4c6da2016e6efe8c (diff)
add failing test
Diffstat (limited to 'src/path-search.cpp')
-rw-r--r--src/path-search.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/path-search.cpp b/src/path-search.cpp
index 11fddce1..1f9b5bf9 100644
--- a/src/path-search.cpp
+++ b/src/path-search.cpp
@@ -54,9 +54,8 @@ bool search::sample_rtree_1(chunk& c, Vector2 min, Vector2 max, object_id own_id
return is_passable;
}
-bool search::sample_rtree(world& w, chunk_coords_ ch0, Vector2 center, Vector2 size, object_id own_id)
+bool search::sample_rtree(world& w, chunk_coords_ ch0, Vector2 min, Vector2 max, object_id own_id)
{
- const auto min = center - size*.5f, max = min + size;
if (auto* c = w.at(ch0))
// it's not correct to return true if c == nullptr
// because neighbors can still contain bounding boxes for that tile
@@ -85,10 +84,12 @@ bool search::sample_rtree(world& w, chunk_coords_ ch0, Vector2 center, Vector2 s
return true;
}
-bool search::sample_rtree(world& w, global_coords coord, Vector2b offset, Vector2ub size, object_id own_id)
+bool search::sample_rtree(world& w, global_coords coord, Vector2b offset, Vector2ub size_, object_id own_id)
{
auto center = iTILE_SIZE2 * Vector2i(coord.local()) + Vector2i(offset);
- return sample_rtree(w, coord, Vector2(center), Vector2(size), own_id);
+ auto size = Vector2(size_);
+ auto min = Vector2(center) - size*.5f, max = min + size;
+ return sample_rtree(w, coord, min, max, own_id);
}
auto search::make_neighbor_tile_bbox(Vector2i coord, Vector2ub own_size, rotation r) -> bbox