Don't show Attack dialog if all attacker weapons are disabled
This commit is contained in:
parent
276047ce96
commit
a0453ad5d7
1 changed files with 7 additions and 1 deletions
|
@ -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."));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue