diff options
| author | Rémi Verschelde | 2017-05-22 15:16:20 +0200 |
|---|---|---|
| committer | GitHub | 2017-05-22 15:16:20 +0200 |
| commit | ce51138b38d00ff6ed13a58f8187f8b0f604bc30 (patch) | |
| tree | 5143449157a33e50569612e00ca62c9851f0e55c /core/math/a_star.cpp | |
| parent | 6dfab3c7e92992293c536248d2244c12da8aef38 (diff) | |
| parent | bd91730347b33fd88d3944dc63fed06655f0b736 (diff) | |
| download | godot-ce51138b38d00ff6ed13a58f8187f8b0f604bc30.tar.gz godot-ce51138b38d00ff6ed13a58f8187f8b0f604bc30.tar.zst godot-ce51138b38d00ff6ed13a58f8187f8b0f604bc30.zip | |
Diffstat (limited to 'core/math/a_star.cpp')
| -rw-r--r-- | core/math/a_star.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index fa8414427..320990cc5 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -193,8 +193,7 @@ bool AStar::_solve(Point *begin_point, Point *end_point) { Point *n = begin_point->neighbours[i]; n->prev_point = begin_point; - n->distance = _compute_cost(n->id, begin_point->id); - n->distance *= n->weight_scale; + n->distance = _compute_cost(begin_point->id, n->id) * n->weight_scale; n->last_pass = pass; open_list.add(&n->list); @@ -238,8 +237,7 @@ bool AStar::_solve(Point *begin_point, Point *end_point) { Point *e = p->neighbours[i]; - real_t distance = _compute_cost(p->id, e->id) + p->distance; - distance *= e->weight_scale; + real_t distance = _compute_cost(p->id, e->id) * e->weight_scale + p->distance; if (e->last_pass == pass) { //oh this was visited already, can we win the cost? |
