Skip to content

Commit

Permalink
move_leader_to_keep CA: prevent error message
Browse files Browse the repository at this point in the history
Previously, trying to move the leader toward an occupied keep hex caused an E_NOT_REACHED_DESTINATION error.

Fixes #5345
  • Loading branch information
mattsc committed Feb 20, 2021
1 parent 09c8c50 commit 1ec1405
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/ai/default/ca.cpp
Expand Up @@ -491,11 +491,9 @@ double move_leader_to_keep_phase::evaluate()
map_location next_hop = map_location::null_location();
int next_hop_cost = 0;
for (const map_location& step : route.steps) {
if (leader_paths.destinations.contains(step)) {
if (leader_paths.destinations.contains(step) && units_.count(step) == 0) {
next_hop = step;
next_hop_cost += leader->movement_cost(resources::gameboard->map().get_terrain(step));
} else {
break;
}
}
if (next_hop == map_location::null_location()) {
Expand Down

0 comments on commit 1ec1405

Please sign in to comment.