Skip to content

Commit

Permalink
Merge pull request #947 from Spartan322/4.3.1-cherry-pick/bugs-misc
Browse files Browse the repository at this point in the history
[4.3] Cherry-picks for the 4.3 (4.3.1) branch - 1st misc bugs batch
  • Loading branch information
Spartan322 authored Jan 23, 2025
2 parents af00a96 + 05bffa8 commit a07fa3f
Show file tree
Hide file tree
Showing 70 changed files with 1,361 additions and 1,402 deletions.
16 changes: 8 additions & 8 deletions core/math/a_star.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ Vector3 AStar3D::get_closest_position_in_segment(const Vector3 &p_point) const {
return closest_point;
}

bool AStar3D::_solve(Point *begin_point, Point *end_point) {
bool AStar3D::_solve(Point *begin_point, Point *end_point, bool p_allow_partial_path) {
last_closest_point = nullptr;
pass++;

if (!end_point->enabled) {
if (!end_point->enabled && !p_allow_partial_path) {
return false;
}

Expand Down Expand Up @@ -445,7 +445,7 @@ Vector<Vector3> AStar3D::get_point_path(int64_t p_from_id, int64_t p_to_id, bool
Point *begin_point = a;
Point *end_point = b;

bool found_route = _solve(begin_point, end_point);
bool found_route = _solve(begin_point, end_point, p_allow_partial_path);
if (!found_route) {
if (!p_allow_partial_path || last_closest_point == nullptr) {
return Vector<Vector3>();
Expand Down Expand Up @@ -499,7 +499,7 @@ Vector<int64_t> AStar3D::get_id_path(int64_t p_from_id, int64_t p_to_id, bool p_
Point *begin_point = a;
Point *end_point = b;

bool found_route = _solve(begin_point, end_point);
bool found_route = _solve(begin_point, end_point, p_allow_partial_path);
if (!found_route) {
if (!p_allow_partial_path || last_closest_point == nullptr) {
return Vector<int64_t>();
Expand Down Expand Up @@ -728,7 +728,7 @@ Vector<Vector2> AStar2D::get_point_path(int64_t p_from_id, int64_t p_to_id, bool
AStar3D::Point *begin_point = a;
AStar3D::Point *end_point = b;

bool found_route = _solve(begin_point, end_point);
bool found_route = _solve(begin_point, end_point, p_allow_partial_path);
if (!found_route) {
if (!p_allow_partial_path || astar.last_closest_point == nullptr) {
return Vector<Vector2>();
Expand Down Expand Up @@ -782,7 +782,7 @@ Vector<int64_t> AStar2D::get_id_path(int64_t p_from_id, int64_t p_to_id, bool p_
AStar3D::Point *begin_point = a;
AStar3D::Point *end_point = b;

bool found_route = _solve(begin_point, end_point);
bool found_route = _solve(begin_point, end_point, p_allow_partial_path);
if (!found_route) {
if (!p_allow_partial_path || astar.last_closest_point == nullptr) {
return Vector<int64_t>();
Expand Down Expand Up @@ -818,11 +818,11 @@ Vector<int64_t> AStar2D::get_id_path(int64_t p_from_id, int64_t p_to_id, bool p_
return path;
}

bool AStar2D::_solve(AStar3D::Point *begin_point, AStar3D::Point *end_point) {
bool AStar2D::_solve(AStar3D::Point *begin_point, AStar3D::Point *end_point, bool p_allow_partial_path) {
astar.last_closest_point = nullptr;
astar.pass++;

if (!end_point->enabled) {
if (!end_point->enabled && !p_allow_partial_path) {
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions core/math/a_star.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class AStar3D : public RefCounted {
HashSet<Segment, Segment> segments;
Point *last_closest_point = nullptr;

bool _solve(Point *begin_point, Point *end_point);
bool _solve(Point *begin_point, Point *end_point, bool p_allow_partial_path);

protected:
static void _bind_methods();
Expand Down Expand Up @@ -173,7 +173,7 @@ class AStar2D : public RefCounted {
GDCLASS(AStar2D, RefCounted);
AStar3D astar;

bool _solve(AStar3D::Point *begin_point, AStar3D::Point *end_point);
bool _solve(AStar3D::Point *begin_point, AStar3D::Point *end_point, bool p_allow_partial_path);

protected:
static void _bind_methods();
Expand Down
Loading

0 comments on commit a07fa3f

Please sign in to comment.