Skip to content

Commit

Permalink
Prevent high eye encumbrance from blinding players
Browse files Browse the repository at this point in the history
Due to the way range of vision was calculated, when the player had high
eye encumbrance, it could become negative and prevent the player from
seeing anything, including their own tile.
The player should never be unable to tell where they are, even if they
cannot see anything else, so prevent range from becoming less than 1.
  • Loading branch information
anothersimulacrum committed Jan 4, 2020
1 parent ed9e547 commit 5c02744
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,9 @@ float Character::get_vision_threshold( float light_level ) const
range++;
}

// Clamp range to 1+, so that we can always see where we are
range = std::max( 1.0f, range );

return std::min( static_cast<float>( LIGHT_AMBIENT_LOW ),
threshold_for_range( range ) * dimming_from_light );
}
Expand Down

0 comments on commit 5c02744

Please sign in to comment.