mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-08 13:58:00 +00:00
AI goals: do not protect units hidden from the AI
This commit is contained in:
parent
8160d9add4
commit
d0f1b27dee
@ -263,8 +263,12 @@ void protect_goal::add_targets(std::back_insert_iterator< std::vector< target >>
|
||||
const unit_filter ufilt{ vconfig(criteria) };
|
||||
for (const unit &u : units)
|
||||
{
|
||||
//TODO: we will protect hidden units, by not testing for invisibility to current side
|
||||
if (ufilt(u)) {
|
||||
// 'protect_unit' can be set to any unit of any side -> exclude hidden units
|
||||
// unless they are visible to the AI side (e.g. allies with shared vision).
|
||||
// As is done in other parts of the AI, units under fog/shroud count as visible to the AI.
|
||||
if (ufilt(u)
|
||||
&& (!u.invisible(u.get_location()) || u.is_visible_to_team(current_team(), false)))
|
||||
{
|
||||
DBG_AI_GOAL << "side " << get_side() << ": in " << goal_type << ": " << u.get_location() << " should be protected\n";
|
||||
items.insert(u.get_location());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user