Skip to content

Commit

Permalink
sees checks outside of max view distance always fail (#69916)
Browse files Browse the repository at this point in the history
  • Loading branch information
esotericist authored Dec 2, 2023
1 parent e3831a5 commit d9741cd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lightmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,12 +789,17 @@ bool tinymap::pl_sees( const tripoint &, int ) const

bool map::pl_sees( const tripoint &t, const int max_range ) const
{
Character &player_character = get_player_character();

if( square_dist( t, player_character.pos() ) > MAX_VIEW_DISTANCE ) {
return false;
}

if( !inbounds( t ) ) {
return false;
}

const level_cache &map_cache = get_cache_ref( t.z );
Character &player_character = get_player_character();
if( max_range >= 0 && square_dist( t, player_character.pos() ) > max_range &&
map_cache.camera_cache[t.x][t.y] == 0 ) {
return false; // Out of range!
Expand Down

0 comments on commit d9741cd

Please sign in to comment.