Merge pull request #8786 from bojidar-bg/fix-astar-weight-scale
Fix weigth scale of A* being applied to the whole estimation
This commit is contained in:
commit
ce51138b38
|
@ -193,8 +193,7 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
|
||||||
|
|
||||||
Point *n = begin_point->neighbours[i];
|
Point *n = begin_point->neighbours[i];
|
||||||
n->prev_point = begin_point;
|
n->prev_point = begin_point;
|
||||||
n->distance = _compute_cost(n->id, begin_point->id);
|
n->distance = _compute_cost(begin_point->id, n->id) * n->weight_scale;
|
||||||
n->distance *= n->weight_scale;
|
|
||||||
n->last_pass = pass;
|
n->last_pass = pass;
|
||||||
open_list.add(&n->list);
|
open_list.add(&n->list);
|
||||||
|
|
||||||
|
@ -238,8 +237,7 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
|
||||||
|
|
||||||
Point *e = p->neighbours[i];
|
Point *e = p->neighbours[i];
|
||||||
|
|
||||||
real_t distance = _compute_cost(p->id, e->id) + p->distance;
|
real_t distance = _compute_cost(p->id, e->id) * e->weight_scale + p->distance;
|
||||||
distance *= e->weight_scale;
|
|
||||||
|
|
||||||
if (e->last_pass == pass) {
|
if (e->last_pass == pass) {
|
||||||
//oh this was visited already, can we win the cost?
|
//oh this was visited already, can we win the cost?
|
||||||
|
|
Loading…
Reference in New Issue