Skip to content

Commit

Permalink
Fix DBZ in character sight range calculation (#39212)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhilkinSerg authored Apr 3, 2020
1 parent b6cc66a commit 0728fde
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 @@ -642,6 +642,9 @@ const tripoint &Character::pos() const

int Character::sight_range( int light_level ) const
{
if( light_level == 0 ) {
return 1;
}
/* Via Beer-Lambert we have:
* light_level * (1 / exp( LIGHT_TRANSPARENCY_OPEN_AIR * distance) ) <= LIGHT_AMBIENT_LOW
* Solving for distance:
Expand Down

0 comments on commit 0728fde

Please sign in to comment.