1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

Add get_points method to AStar

This commit is contained in:
Scayze
2017-09-07 16:11:48 +02:00
parent 36e91b07d8
commit 6872cc7b12
2 changed files with 12 additions and 0 deletions

View File

@@ -129,6 +129,16 @@ bool AStar::has_point(int p_id) const {
return points.has(p_id);
}
Array AStar::get_points() {
Array point_list;
for (const Map<int, Point *>::Element *E = points.front(); E; E = E->next()) {
point_list.push_back(E->key());
}
return point_list;
}
bool AStar::are_points_connected(int p_id, int p_with_id) const {
Segment s(p_id, p_with_id);
@@ -407,6 +417,7 @@ void AStar::_bind_methods() {
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("get_points"), &AStar::get_points);
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);