Skip to content

Commit

Permalink
RCA AI: fix a bug that kept surrounded units from attacking
Browse files Browse the repository at this point in the history
In the equation below the line changed, support is a measure of how
many AI units can come and aid the attacking unit.  For a surrounded
unit, support=0, and thus the attack rating (value) was previously
always zero, meaning that the unit never attacked.
This fixes bug #21334:
  • Loading branch information
mattsc committed Dec 8, 2013
1 parent 20b0f3a commit e7f1741
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ai/default/attack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ double attack_analysis::rating(double aggression, const readonly_context& ai_obj
}
}

if(!leader_threat && vulnerability*terrain_quality > 0.0) {
if(!leader_threat && vulnerability*terrain_quality > 0.0 && !is_surrounded) {
value *= support/(vulnerability*terrain_quality);
}

Expand Down

0 comments on commit e7f1741

Please sign in to comment.