summaryrefslogtreecommitdiffhomepage
path: root/src/path-search.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/path-search.cpp')
-rw-r--r--src/path-search.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/path-search.cpp b/src/path-search.cpp
index 119a6e01..3a678388 100644
--- a/src/path-search.cpp
+++ b/src/path-search.cpp
@@ -50,6 +50,7 @@ bool path_search::is_passable_1(chunk& c, Vector2 min, Vector2 max, object_id ow
bool path_search::is_passable(world& w, chunk_coords_ ch0, Vector2 min, Vector2 max, object_id own_id)
{
fm_debug_assert(max >= min);
+
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
@@ -60,15 +61,15 @@ bool path_search::is_passable(world& w, chunk_coords_ ch0, Vector2 min, Vector2
{
static_assert(iTILE_SIZE2.x() == iTILE_SIZE2.y());
constexpr auto chunk_size = iTILE_SIZE2 * TILE_MAX_DIM;
- constexpr auto bbox_max = -Vector2i(1 << sizeof(Vector2b().x())*8);
- constexpr auto chunk_max = chunk_size + Vector2i(bbox_max);
+ constexpr auto bbox_size = Vector2i(1 << sizeof(Vector2b().x())*8);
+ constexpr auto chunk_max = chunk_size + bbox_size;
const auto off = Vector2(nb)*Vector2(chunk_size);
const auto min_ = min - off, max_ = max - off;
if (min_.x() > chunk_max.x() || min_.y() > chunk_max.y())
continue;
- if (max_.x() < bbox_max.x() || max_.y() < bbox_max.y())
+ if (max_.x() < -bbox_size.x() || max_.y() < -bbox_size.y())
continue;
if (auto* c2 = w.at(ch0 + Vector2i(nb)))