Browse Source

Merge pull request #86983 from jsjtxietian/a-star

Make `get_id_path` return empty when first point is disabled
Rémi Verschelde 2 tháng trước cách đây
mục cha
commit
d364bd7e73
1 tập tin đã thay đổi với 8 bổ sung0 xóa
  1. 8 0
      core/math/a_star.cpp

+ 8 - 0
core/math/a_star.cpp

@@ -481,6 +481,10 @@ Vector<int64_t> AStar3D::get_id_path(int64_t p_from_id, int64_t p_to_id, bool p_
 		return ret;
 	}
 
+	if (!a->enabled) {
+		return Vector<int64_t>();
+	}
+
 	Point *begin_point = a;
 	Point *end_point = b;
 
@@ -764,6 +768,10 @@ Vector<int64_t> AStar2D::get_id_path(int64_t p_from_id, int64_t p_to_id, bool p_
 		return ret;
 	}
 
+	if (!a->enabled) {
+		return Vector<int64_t>();
+	}
+
 	AStar3D::Point *begin_point = a;
 	AStar3D::Point *end_point = b;