Skip to content

Commit a682b07

Browse files
committed
Merge pull request #101223 from kiroxas/fixWrongIfConditionIn#100549
Fix wrong condition in `NavMeshQueries3D::_query_task_build_path_corridor`
2 parents 65cf7c1 + f70acb0 commit a682b07

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

modules/navigation/3d/nav_mesh_queries_3d.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ void NavMeshQueries3D::_query_task_build_path_corridor(NavMeshPathQueryTask3D &p
314314
owner->get_travel_cost();
315315
neighbor_poly.entry = new_entry;
316316

317-
if (neighbor_poly.poly != nullptr) {
317+
if (neighbor_poly.traversable_poly_index != traversable_polys.INVALID_INDEX) {
318318
traversable_polys.shift(neighbor_poly.traversable_poly_index);
319319
} else {
320320
neighbor_poly.poly = connection.polygon;

modules/navigation/nav_utils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ class Heap {
201201
Indexer _indexer;
202202

203203
public:
204+
static constexpr uint32_t INVALID_INDEX = UINT32_MAX;
204205
void reserve(uint32_t p_size) {
205206
_buffer.reserve(p_size);
206207
}
@@ -222,7 +223,7 @@ class Heap {
222223
T pop() {
223224
ERR_FAIL_COND_V_MSG(_buffer.is_empty(), T(), "Can't pop an empty heap.");
224225
T value = _buffer[0];
225-
_indexer(value, UINT32_MAX);
226+
_indexer(value, INVALID_INDEX);
226227
if (_buffer.size() > 1) {
227228
_buffer[0] = _buffer[_buffer.size() - 1];
228229
_indexer(_buffer[0], 0);
@@ -246,7 +247,7 @@ class Heap {
246247

247248
void clear() {
248249
for (const T &value : _buffer) {
249-
_indexer(value, UINT32_MAX);
250+
_indexer(value, INVALID_INDEX);
250251
}
251252
_buffer.clear();
252253
}

0 commit comments

Comments
 (0)