@@ -321,11 +321,11 @@ Vector3 AStar3D::get_closest_position_in_segment(const Vector3 &p_point) const {
321321 return closest_point;
322322}
323323
324- bool AStar3D::_solve (Point *begin_point, Point *end_point) {
324+ bool AStar3D::_solve (Point *begin_point, Point *end_point, bool p_allow_partial_path ) {
325325 last_closest_point = nullptr ;
326326 pass++;
327327
328- if (!end_point->enabled ) {
328+ if (!end_point->enabled && !p_allow_partial_path ) {
329329 return false ;
330330 }
331331
@@ -445,7 +445,7 @@ Vector<Vector3> AStar3D::get_point_path(int64_t p_from_id, int64_t p_to_id, bool
445445 Point *begin_point = a;
446446 Point *end_point = b;
447447
448- bool found_route = _solve (begin_point, end_point);
448+ bool found_route = _solve (begin_point, end_point, p_allow_partial_path );
449449 if (!found_route) {
450450 if (!p_allow_partial_path || last_closest_point == nullptr ) {
451451 return Vector<Vector3>();
@@ -499,7 +499,7 @@ Vector<int64_t> AStar3D::get_id_path(int64_t p_from_id, int64_t p_to_id, bool p_
499499 Point *begin_point = a;
500500 Point *end_point = b;
501501
502- bool found_route = _solve (begin_point, end_point);
502+ bool found_route = _solve (begin_point, end_point, p_allow_partial_path );
503503 if (!found_route) {
504504 if (!p_allow_partial_path || last_closest_point == nullptr ) {
505505 return Vector<int64_t >();
@@ -728,7 +728,7 @@ Vector<Vector2> AStar2D::get_point_path(int64_t p_from_id, int64_t p_to_id, bool
728728 AStar3D::Point *begin_point = a;
729729 AStar3D::Point *end_point = b;
730730
731- bool found_route = _solve (begin_point, end_point);
731+ bool found_route = _solve (begin_point, end_point, p_allow_partial_path );
732732 if (!found_route) {
733733 if (!p_allow_partial_path || astar.last_closest_point == nullptr ) {
734734 return Vector<Vector2>();
@@ -782,7 +782,7 @@ Vector<int64_t> AStar2D::get_id_path(int64_t p_from_id, int64_t p_to_id, bool p_
782782 AStar3D::Point *begin_point = a;
783783 AStar3D::Point *end_point = b;
784784
785- bool found_route = _solve (begin_point, end_point);
785+ bool found_route = _solve (begin_point, end_point, p_allow_partial_path );
786786 if (!found_route) {
787787 if (!p_allow_partial_path || astar.last_closest_point == nullptr ) {
788788 return Vector<int64_t >();
@@ -818,11 +818,11 @@ Vector<int64_t> AStar2D::get_id_path(int64_t p_from_id, int64_t p_to_id, bool p_
818818 return path;
819819}
820820
821- bool AStar2D::_solve (AStar3D::Point *begin_point, AStar3D::Point *end_point) {
821+ bool AStar2D::_solve (AStar3D::Point *begin_point, AStar3D::Point *end_point, bool p_allow_partial_path ) {
822822 astar.last_closest_point = nullptr ;
823823 astar.pass ++;
824824
825- if (!end_point->enabled ) {
825+ if (!end_point->enabled && !p_allow_partial_path ) {
826826 return false ;
827827 }
828828
0 commit comments