Skip to content

Commit

Permalink
fix filter not working in [disable] (#2826)
Browse files Browse the repository at this point in the history
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

(cherry-picked from commit c4cf0c9)
  • Loading branch information
gfgtdf authored and Vultraz committed Oct 7, 2018
1 parent 8eee8aa commit fc79727
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
8 changes: 0 additions & 8 deletions src/actions/attack.cpp
Expand Up @@ -366,14 +366,6 @@ battle_context::battle_context(const unit_map& units,
const unit& defender = *units.find(defender_loc);
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) {
attacker_weapon = choose_attacker_weapon(
attacker, defender, units, attacker_loc, defender_loc, harm_weight, &defender_weapon, prev_def
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/unit_attack.cpp
Expand Up @@ -122,7 +122,7 @@ void unit_attack::pre_show(window& window)
*defender.weapon : *no_weapon;

// 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;
}

Expand Down

0 comments on commit fc79727

Please sign in to comment.