diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-11-08 14:18:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-08 14:18:26 +0100 |
commit | 0e54b2d43c8d48b97fc3300dea679a05efa28dca (patch) | |
tree | 8bae23b1be1d0afa688ee989b85be9e8ea67a7d4 | |
parent | 6049c32cd46d4ac09d2c9d5afd6af05df9d8c653 (diff) | |
parent | aac7ddf89f5ddc3fa69052bf13b2dd2c94236227 (diff) |
Merge pull request #33445 from kawa-yoiko/astar-soft-error
Emit an error rather than crash in A*
-rw-r--r-- | core/math/a_star.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 810e290922..bfa8b90344 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -184,11 +184,11 @@ void AStar::disconnect_points(int p_id, int p_with_id, bool bidirectional) { Point *a; bool a_exists = points.lookup(p_id, a); - CRASH_COND(!a_exists); + ERR_FAIL_COND(!a_exists); Point *b; bool b_exists = points.lookup(p_with_id, b); - CRASH_COND(!b_exists); + ERR_FAIL_COND(!b_exists); Segment s(p_id, p_with_id); int remove_direction = bidirectional ? (int)Segment::BIDIRECTIONAL : s.direction; @@ -406,11 +406,11 @@ float AStar::_estimate_cost(int p_from_id, int p_to_id) { Point *from_point; bool from_exists = points.lookup(p_from_id, from_point); - CRASH_COND(!from_exists); + ERR_FAIL_COND_V(!from_exists, 0); Point *to_point; bool to_exists = points.lookup(p_to_id, to_point); - CRASH_COND(!to_exists); + ERR_FAIL_COND_V(!to_exists, 0); return from_point->pos.distance_to(to_point->pos); } @@ -422,11 +422,11 @@ float AStar::_compute_cost(int p_from_id, int p_to_id) { Point *from_point; bool from_exists = points.lookup(p_from_id, from_point); - CRASH_COND(!from_exists); + ERR_FAIL_COND_V(!from_exists, 0); Point *to_point; bool to_exists = points.lookup(p_to_id, to_point); - CRASH_COND(!to_exists); + ERR_FAIL_COND_V(!to_exists, 0); return from_point->pos.distance_to(to_point->pos); } |