Skip to content

Commit

Permalink
Don't show Attack dialog if all attacker weapons are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Sep 8, 2016
1 parent 276047c commit a0453ad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/mouse_events.cpp
Expand Up @@ -967,7 +967,13 @@ int mouse_handler::show_attack_dialog(const map_location& attacker_loc, const ma
return -1; // abort, click will do nothing
}

if ((*attacker).attacks().empty()) {
auto attacker_weapons = (*attacker).attacks();

const bool all_disabled = std::all_of(attacker_weapons.begin(), attacker_weapons.end(), [](attack_type& attack) {
return attack.get_special_bool("disable");
});

if(attacker_weapons.empty() || all_disabled) {
gui2::show_transient_message(gui_->video(), "No Attacks",
_("This unit has no usable weapons."));

Expand Down

0 comments on commit a0453ad

Please sign in to comment.