diff options
author | Poommetee Ketson <poommetee@protonmail.com> | 2017-07-11 21:04:41 +0700 |
---|---|---|
committer | Poommetee Ketson <poommetee@protonmail.com> | 2017-07-11 21:06:30 +0700 |
commit | 2c9f6312e2d737be76a0ed14ae87df31a96e73a4 (patch) | |
tree | 056d9f546a782ff62838965a03331059ba071c74 /core | |
parent | a5d500f0233913fe7622434225c5dc73ebaccd1e (diff) |
AStar: add bool has_point(id)
Diffstat (limited to 'core')
-rw-r--r-- | core/math/a_star.cpp | 7 | ||||
-rw-r--r-- | core/math/a_star.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 838fec22f0..04e4383f03 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -123,6 +123,12 @@ void AStar::disconnect_points(int p_id, int p_with_id) { a->neighbours.erase(b); b->neighbours.erase(a); } + +bool AStar::has_point(int p_id) const { + + return points.has(p_id); +} + bool AStar::are_points_connected(int p_id, int p_with_id) const { Segment s(p_id, p_with_id); @@ -400,6 +406,7 @@ void AStar::_bind_methods() { ClassDB::bind_method(D_METHOD("get_point_pos", "id"), &AStar::get_point_pos); ClassDB::bind_method(D_METHOD("get_point_weight_scale", "id"), &AStar::get_point_weight_scale); ClassDB::bind_method(D_METHOD("remove_point", "id"), &AStar::remove_point); + ClassDB::bind_method(D_METHOD("has_point", "id"), &AStar::has_point); ClassDB::bind_method(D_METHOD("connect_points", "id", "to_id", "bidirectional"), &AStar::connect_points, DEFVAL(true)); ClassDB::bind_method(D_METHOD("disconnect_points", "id", "to_id"), &AStar::disconnect_points); diff --git a/core/math/a_star.h b/core/math/a_star.h index 34a5358344..ebf1407c17 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -104,6 +104,7 @@ public: Vector3 get_point_pos(int p_id) const; real_t get_point_weight_scale(int p_id) const; void remove_point(int p_id); + bool has_point(int p_id) const; void connect_points(int p_id, int p_with_id, bool bidirectional = true); void disconnect_points(int p_id, int p_with_id); |