Explorar el Código

Make get_id_path return empty when first point is disabled

jsjtxietian hace 1 año
padre
commit
6f094856e7
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  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;