@@ -321,11 +321,11 @@ Vector3 AStar3D::get_closest_position_in_segment(const Vector3 &p_point) const {
321
321
return closest_point;
322
322
}
323
323
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 ) {
325
325
last_closest_point = nullptr ;
326
326
pass++;
327
327
328
- if (!end_point->enabled ) {
328
+ if (!end_point->enabled && !p_allow_partial_path ) {
329
329
return false ;
330
330
}
331
331
@@ -445,7 +445,7 @@ Vector<Vector3> AStar3D::get_point_path(int64_t p_from_id, int64_t p_to_id, bool
445
445
Point *begin_point = a;
446
446
Point *end_point = b;
447
447
448
- bool found_route = _solve (begin_point, end_point);
448
+ bool found_route = _solve (begin_point, end_point, p_allow_partial_path );
449
449
if (!found_route) {
450
450
if (!p_allow_partial_path || last_closest_point == nullptr ) {
451
451
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_
499
499
Point *begin_point = a;
500
500
Point *end_point = b;
501
501
502
- bool found_route = _solve (begin_point, end_point);
502
+ bool found_route = _solve (begin_point, end_point, p_allow_partial_path );
503
503
if (!found_route) {
504
504
if (!p_allow_partial_path || last_closest_point == nullptr ) {
505
505
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
728
728
AStar3D::Point *begin_point = a;
729
729
AStar3D::Point *end_point = b;
730
730
731
- bool found_route = _solve (begin_point, end_point);
731
+ bool found_route = _solve (begin_point, end_point, p_allow_partial_path );
732
732
if (!found_route) {
733
733
if (!p_allow_partial_path || astar.last_closest_point == nullptr ) {
734
734
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_
782
782
AStar3D::Point *begin_point = a;
783
783
AStar3D::Point *end_point = b;
784
784
785
- bool found_route = _solve (begin_point, end_point);
785
+ bool found_route = _solve (begin_point, end_point, p_allow_partial_path );
786
786
if (!found_route) {
787
787
if (!p_allow_partial_path || astar.last_closest_point == nullptr ) {
788
788
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_
818
818
return path;
819
819
}
820
820
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 ) {
822
822
astar.last_closest_point = nullptr ;
823
823
astar.pass ++;
824
824
825
- if (!end_point->enabled ) {
825
+ if (!end_point->enabled && !p_allow_partial_path ) {
826
826
return false ;
827
827
}
828
828
0 commit comments