Permalink
Browse files

RCA AI: fix a bug that kept surrounded units from attacking

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...
1 parent 20b0f3a commit e7f17412378bd81d2c89c0f391d97894c2cc80d2 @mattsc mattsc committed Dec 8, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/ai/default/attack.cpp
@@ -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);
}

0 comments on commit e7f1741

Please sign in to comment.