Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: empty underslung gun doesnt prevent going into firing mode UI #4292

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/avatar_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,12 +675,13 @@ bool avatar_action::can_fire_weapon( avatar &you, const map &m, const item &weap

std::vector<std::string> messages;

const gun_mode &mode = weapon.gun_current_mode();
bool check_common = ranged::gunmode_checks_common( you, m, messages, mode );
bool check_weapon = ranged::gunmode_checks_weapon( you, m, messages, mode );
bool can_use_mode = check_common && check_weapon;
if( can_use_mode ) {
return true;
for( const std::pair<const gun_mode_id, gun_mode> &mode_map : weapon.gun_all_modes() ) {
const bool check_common = ranged::gunmode_checks_common( you, m, messages, mode_map.second );
const bool check_weapon = ranged::gunmode_checks_weapon( you, m, messages, mode_map.second );
const bool can_use_mode = check_common && check_weapon;
if( can_use_mode ) {
return true;
}
}

for( const std::string &message : messages ) {
Expand Down
Loading