|
8 | 8 | #include "creature_tracker.h"
|
9 | 9 | #include "event_bus.h"
|
10 | 10 | #include "explosion.h"
|
11 |
| -#include "field.h" |
12 | 11 | #include "game.h"
|
13 | 12 | #include "gamemode.h"
|
14 | 13 | #include "help.h"
|
|
35 | 34 | #include "wcwidth.h"
|
36 | 35 | #include "worldfactory.h"
|
37 | 36 |
|
38 |
| -static const activity_id ACT_AIM( "ACT_AIM" ); |
39 | 37 | static const activity_id ACT_AUTODRIVE( "ACT_AUTODRIVE" );
|
40 | 38 | static const activity_id ACT_OPERATION( "ACT_OPERATION" );
|
41 | 39 |
|
@@ -729,32 +727,13 @@ bool do_turn()
|
729 | 727 | // If player is performing a task, a monster is dangerously close,
|
730 | 728 | // and monster can reach to the player or it has some sort of a ranged attack,
|
731 | 729 | // warn them regardless of previous safemode warnings
|
732 |
| - if( u.activity && !u.has_activity( ACT_AIM ) && |
733 |
| - u.activity.moves_left > 0 && |
734 |
| - !u.activity.is_distraction_ignored( distraction_type::hostile_spotted_near ) ) { |
735 |
| - Creature *hostile_critter = g->is_hostile_very_close( true ); |
736 |
| - |
737 |
| - if( hostile_critter != nullptr ) { |
738 |
| - g->cancel_activity_or_ignore_query( distraction_type::hostile_spotted_near, |
739 |
| - string_format( _( "The %s is dangerously close!" ), |
740 |
| - hostile_critter->get_name() ) ); |
741 |
| - } |
742 |
| - } |
743 |
| - |
744 |
| - if( u.activity && !u.has_activity( ACT_AIM ) && u.activity.moves_left > 0 && |
745 |
| - !u.activity.is_distraction_ignored( distraction_type::dangerous_field ) ) { |
746 |
| - for( const std::pair<const field_type_id, field_entry> &field : m.field_at( u.pos() ) ) { |
747 |
| - if( u.is_dangerous_field( field.second ) ) { |
748 |
| - if( g->cancel_activity_or_ignore_query( distraction_type::dangerous_field, |
749 |
| - string_format( _( "You stand in %s!" ), |
750 |
| - field.second.name() ) ) || |
751 |
| - u.activity.is_distraction_ignored( distraction_type::dangerous_field ) ) { |
752 |
| - break; |
753 |
| - } |
| 730 | + if( u.activity ) { |
| 731 | + for( std::pair<const distraction_type, std::string> &dist : u.activity.get_distractions() ) { |
| 732 | + if( g->cancel_activity_or_ignore_query( dist.first, dist.second ) ) { |
| 733 | + break; |
754 | 734 | }
|
755 | 735 | }
|
756 | 736 | }
|
757 |
| - |
758 | 737 | }
|
759 | 738 | }
|
760 | 739 |
|
|
0 commit comments