Skip to content

Commit a16423a

Browse files
authored
Merge pull request #82174 from RenechCDDA/no_reach_attack_thru_floor
Abort 'fired' reach attack if there are no valid targets
2 parents 1802820 + eb1acab commit a16423a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ranged.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2754,6 +2754,12 @@ target_handler::trajectory target_ui::run()
27542754
src = you->pos_bub();
27552755
update_target_list();
27562756

2757+
if( mode == TargetMode::Reach && targets.empty() ) {
2758+
add_msg( m_info, _( "No hostile creature in reach." ) );
2759+
traj.clear();
2760+
return traj; // nothing to attack.
2761+
}
2762+
27572763
if( activity && activity->abort_if_no_targets && targets.empty() ) {
27582764
// this branch is taken when already shot once and re-entered
27592765
// aiming, if no targets are available we want to abort so

0 commit comments

Comments
 (0)