Actually I can just use the ai::distance_to_goal function on the fit_sort to sort by cost and distance.
This commit is contained in:
parent
c1aba2d5c8
commit
b6c1eba1b3
1 changed files with 2 additions and 2 deletions
4
ai.cpp
4
ai.cpp
|
@ -167,8 +167,8 @@ namespace ai {
|
|||
if(active()) {
|
||||
std::sort(plan.script.begin(), plan.script.end(),
|
||||
[&](auto& l, auto& r) {
|
||||
int l_cost = l.cost + (!l.can_effect(start) * ai::SCORE_MAX);
|
||||
int r_cost = r.cost + (!r.can_effect(start) * ai::SCORE_MAX);
|
||||
int l_cost = l.cost + ai::distance_to_goal(start, goal);
|
||||
int r_cost = r.cost + ai::distance_to_goal(start, goal);
|
||||
return l_cost < r_cost;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue