2
0
mirror of https://github.com/godotengine/godot.git synced 2025-04-13 01:00:35 +08:00
Fix wrong condition in `NavMeshQueries3D::_query_task_build_path_corridor`
This commit is contained in:
Rémi Verschelde 2025-01-09 11:17:28 +01:00
commit a682b076d7
2 changed files with 4 additions and 3 deletions

@ -314,7 +314,7 @@ void NavMeshQueries3D::_query_task_build_path_corridor(NavMeshPathQueryTask3D &p
owner->get_travel_cost();
neighbor_poly.entry = new_entry;
if (neighbor_poly.poly != nullptr) {
if (neighbor_poly.traversable_poly_index != traversable_polys.INVALID_INDEX) {
traversable_polys.shift(neighbor_poly.traversable_poly_index);
} else {
neighbor_poly.poly = connection.polygon;

@ -201,6 +201,7 @@ class Heap {
Indexer _indexer;
public:
static constexpr uint32_t INVALID_INDEX = UINT32_MAX;
void reserve(uint32_t p_size) {
_buffer.reserve(p_size);
}
@ -222,7 +223,7 @@ public:
T pop() {
ERR_FAIL_COND_V_MSG(_buffer.is_empty(), T(), "Can't pop an empty heap.");
T value = _buffer[0];
_indexer(value, UINT32_MAX);
_indexer(value, INVALID_INDEX);
if (_buffer.size() > 1) {
_buffer[0] = _buffer[_buffer.size() - 1];
_indexer(_buffer[0], 0);
@ -246,7 +247,7 @@ public:
void clear() {
for (const T &value : _buffer) {
_indexer(value, UINT32_MAX);
_indexer(value, INVALID_INDEX);
}
_buffer.clear();
}