fix filter not working in [disable] (#2826)
The problem was that the specials_context was not set during those two get_special_bool calls This removes what seems to be a rather useless optimisation in battle_context::battle_context since choose_attacker_weapon would just return 0 in that case. fixes #2801
This commit is contained in:
parent
fa8e301c93
commit
650079412c
2 changed files with 1 additions and 9 deletions
|
@ -366,14 +366,6 @@ battle_context::battle_context(const unit_map& units,
|
||||||
const unit& defender = *units.find(defender_loc);
|
const unit& defender = *units.find(defender_loc);
|
||||||
const double harm_weight = 1.0 - aggression;
|
const double harm_weight = 1.0 - aggression;
|
||||||
|
|
||||||
if(attacker_weapon == -1 &&
|
|
||||||
attacker.attacks().size() == 1 &&
|
|
||||||
attacker.attacks()[0].attack_weight() > 0 &&
|
|
||||||
!attacker.attacks()[0].get_special_bool("disable", true)
|
|
||||||
) {
|
|
||||||
attacker_weapon = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(attacker_weapon == -1) {
|
if(attacker_weapon == -1) {
|
||||||
attacker_weapon = choose_attacker_weapon(
|
attacker_weapon = choose_attacker_weapon(
|
||||||
attacker, defender, units, attacker_loc, defender_loc, harm_weight, &defender_weapon, prev_def
|
attacker, defender, units, attacker_loc, defender_loc, harm_weight, &defender_weapon, prev_def
|
||||||
|
|
|
@ -122,7 +122,7 @@ void unit_attack::pre_show(window& window)
|
||||||
*defender.weapon : *no_weapon;
|
*defender.weapon : *no_weapon;
|
||||||
|
|
||||||
// Don't show if the atacker's weapon has at least one active "disable" special.
|
// Don't show if the atacker's weapon has at least one active "disable" special.
|
||||||
if(attacker_weapon.get_special_bool("disable")) {
|
if(attacker.disable) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue