diff --git a/src/monattack.cpp b/src/monattack.cpp index e99004a3e195f..9ef8a9c0b5ddd 100644 --- a/src/monattack.cpp +++ b/src/monattack.cpp @@ -115,13 +115,9 @@ static const trait_id trait_THRESH_MARLOSS( "THRESH_MARLOSS" ); static const trait_id trait_THRESH_MYCUS( "THRESH_MYCUS" ); // shared utility functions -int within_visual_range( monster *z, int max_range ) +bool within_visual_range( monster *z, int max_range ) { - int dist = rl_dist( z->pos(), g->u.pos() ); - if( dist > max_range || !z->sees( g->u ) ) { - return -1; // Out of range - } - return dist; + return !( rl_dist( z->pos(), g->u.pos() ) > max_range || !z->sees( g->u ) ); } bool within_target_range( const monster *const z, const Creature *const target, int range ) @@ -2690,7 +2686,7 @@ bool mattack::fear_paralyze( monster *z ) bool mattack::photograph( monster *z ) { - if( within_visual_range( z, 6 ) < 0 ) { + if( !within_visual_range( z, 6 ) ) { return false; } @@ -3199,8 +3195,7 @@ bool mattack::flamethrower( monster *z ) return true; } - int dist = within_visual_range( z, 5 ); - if( dist < 0 ) { + if( !within_visual_range( z, 5 ) ) { return false; }