Fix the AI's move-to-targets CA ignoring tunnels
This commit is contained in:
parent
3f7b28f85b
commit
06034a6fa1
2 changed files with 8 additions and 3 deletions
|
@ -7,6 +7,7 @@ Version 1.12.5+dev:
|
|||
* Revert all updates to hot-key handling which broke letter-based short-cuts
|
||||
on non-US keyboard layouts, where characters are in different key
|
||||
locations (bug #24186).
|
||||
* Fix the move-to-targets candidate action of the default AI ignoring tunnels
|
||||
|
||||
Version 1.12.5:
|
||||
* Campaigns:
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "../../team.hpp"
|
||||
#include "../../terrain_filter.hpp"
|
||||
#include "../../pathfind/pathfind.hpp"
|
||||
#include "../../pathfind/teleport.hpp"
|
||||
|
||||
#include <deque>
|
||||
|
||||
|
@ -335,7 +336,8 @@ std::pair<map_location,map_location> testing_move_to_targets_phase::choose_move(
|
|||
// to it seeming futile. Be very cautious about changing this value,
|
||||
// as it can cause the AI to give up on searches and just do nothing.
|
||||
const double locStopValue = 500.0;
|
||||
pathfind::plain_route real_route = a_star_search(u->get_location(), tg.loc, locStopValue, &cost_calc, map_.w(), map_.h());
|
||||
const pathfind::teleport_map allowed_teleports = pathfind::get_teleport_locations(*u, current_team());
|
||||
pathfind::plain_route real_route = a_star_search(u->get_location(), tg.loc, locStopValue, &cost_calc, map_.w(), map_.h(), &allowed_teleports);
|
||||
|
||||
if(real_route.steps.empty()) {
|
||||
LOG_AI << "Can't reach target: " << locStopValue << " = " << tg.value << "/" << best_rating << "\n";
|
||||
|
@ -401,7 +403,8 @@ std::pair<map_location,map_location> testing_move_to_targets_phase::choose_move(
|
|||
//const double locStopValue = std::min(best_target->value / best_rating, (double) 100.0);
|
||||
|
||||
const double locStopValue = 500.0;
|
||||
pathfind::plain_route cur_route = pathfind::a_star_search(u->get_location(), best_target->loc, locStopValue, &calc, map_.w(), map_.h());
|
||||
const pathfind::teleport_map allowed_teleports = pathfind::get_teleport_locations(*u, current_team());
|
||||
pathfind::plain_route cur_route = pathfind::a_star_search(u->get_location(), best_target->loc, locStopValue, &calc, map_.w(), map_.h(), &allowed_teleports);
|
||||
|
||||
if(cur_route.steps.empty()) {
|
||||
continue;
|
||||
|
@ -633,7 +636,8 @@ void testing_move_to_targets_phase::access_points(const move_map& srcdst, const
|
|||
const map_location& loc = i->second;
|
||||
if (int(distance_between(loc,dst)) <= u_it->total_movement()) {
|
||||
pathfind::shortest_path_calculator calc(*u_it, current_team(), *resources::teams, map_);
|
||||
pathfind::plain_route rt = a_star_search(loc, dst, u_it->total_movement(), &calc, map_.w(), map_.h());
|
||||
const pathfind::teleport_map allowed_teleports = pathfind::get_teleport_locations(*u_it, current_team());
|
||||
pathfind::plain_route rt = a_star_search(loc, dst, u_it->total_movement(), &calc, map_.w(), map_.h(), &allowed_teleports);
|
||||
if(rt.steps.empty() == false) {
|
||||
out.push_back(loc);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue