aboutsummaryrefslogtreecommitdiff
path: root/src/light.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-11-28 13:48:33 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-11-28 13:48:33 +0100
commiteb6aca8b4a67ef55108231e71ff29a18a29bf5ae (patch)
treef891914d25cae2cdaa24392381436a287340651e /src/light.cpp
parent8de51dae97aa2fe6ea02e4cf437bfe2b2a38eb06 (diff)
parentf1d72d212a0661588be27003069abf4bd8092e55 (diff)
downloaddragonfireclient-eb6aca8b4a67ef55108231e71ff29a18a29bf5ae.tar.xz
Merged Minetest
Diffstat (limited to 'src/light.cpp')
-rw-r--r--src/light.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/light.cpp b/src/light.cpp
index 8196fedff..d5389b450 100644
--- a/src/light.cpp
+++ b/src/light.cpp
@@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "light.h"
+#include <algorithm>
#include <cmath>
#include "util/numeric.h"
#include "settings.h"
@@ -81,9 +82,11 @@ void set_light_table(float gamma)
// Strictly speaking, rangelim is not necessary here—if the implementation
// is conforming. But we don’t want problems in any case.
light_LUT[i] = rangelim((s32)(255.0f * brightness), 0, 255);
+
// Ensure light brightens with each level
- if (i > 1 && light_LUT[i] <= light_LUT[i - 1])
- light_LUT[i] = light_LUT[i - 1] + 1;
+ if (i > 0 && light_LUT[i] <= light_LUT[i - 1]) {
+ light_LUT[i] = std::min((u8)254, light_LUT[i - 1]) + 1;
+ }
}
}