summaryrefslogtreecommitdiff
path: root/core/math/a_star.cpp
diff options
context:
space:
mode:
authorkleonc <9283098+kleonc@users.noreply.github.com>2021-05-22 11:44:34 +0200
committerkleonc <9283098+kleonc@users.noreply.github.com>2021-05-22 11:44:34 +0200
commit17324db4caf61a8bf665d7122ca67da2a2d91043 (patch)
treeec7112e315a774ff4a60050ff581b0503c753a98 /core/math/a_star.cpp
parent3b3a55ca04331e85cc24ac315b60e7ad4aeb17df (diff)
Astar::get_available_point_id Start from 0
Diffstat (limited to 'core/math/a_star.cpp')
-rw-r--r--core/math/a_star.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 88e11a630c..322eb7ac61 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -35,18 +35,12 @@
#include "scene/scene_string_names.h"
int AStar::get_available_point_id() const {
- if (points.is_empty()) {
- return 1;
- }
-
- // calculate our new next available point id if bigger than before or next id already contained in set of points.
if (points.has(last_free_id)) {
- int cur_new_id = last_free_id;
+ int cur_new_id = last_free_id + 1;
while (points.has(cur_new_id)) {
cur_new_id++;
}
- int &non_const = const_cast<int &>(last_free_id);
- non_const = cur_new_id;
+ const_cast<int &>(last_free_id) = cur_new_id;
}
return last_free_id;