From fc797272109dcdb228329c41d9300089a950ffd8 Mon Sep 17 00:00:00 2001 From: gfgtdf Date: Tue, 3 Apr 2018 23:57:09 +0200 Subject: [PATCH] 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 (cherry-picked from commit c4cf0c9da4b24589bd34a8aee9b41cda479ff35c) --- src/actions/attack.cpp | 8 -------- src/gui/dialogs/unit_attack.cpp | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/actions/attack.cpp b/src/actions/attack.cpp index 29e6add59930..5f4c92c6f0ea 100644 --- a/src/actions/attack.cpp +++ b/src/actions/attack.cpp @@ -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 diff --git a/src/gui/dialogs/unit_attack.cpp b/src/gui/dialogs/unit_attack.cpp index d4029002f095..ad4e1ca3468e 100644 --- a/src/gui/dialogs/unit_attack.cpp +++ b/src/gui/dialogs/unit_attack.cpp @@ -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; }