aboutsummaryrefslogtreecommitdiff
path: root/src/particles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/particles.cpp')
-rw-r--r--src/particles.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/particles.cpp b/src/particles.cpp
index 5a3056c32..b1662e10b 100644
--- a/src/particles.cpp
+++ b/src/particles.cpp
@@ -168,18 +168,19 @@ void Particle::step(float dtime)
void Particle::updateLight()
{
u8 light = 0;
- try{
- v3s16 p = v3s16(
- floor(m_pos.X+0.5),
- floor(m_pos.Y+0.5),
- floor(m_pos.Z+0.5)
- );
- MapNode n = m_env->getClientMap().getNode(p);
+ bool pos_ok;
+
+ v3s16 p = v3s16(
+ floor(m_pos.X+0.5),
+ floor(m_pos.Y+0.5),
+ floor(m_pos.Z+0.5)
+ );
+ MapNode n = m_env->getClientMap().getNodeNoEx(p, &pos_ok);
+ if (pos_ok)
light = n.getLightBlend(m_env->getDayNightRatio(), m_gamedef->ndef());
- }
- catch(InvalidPositionException &e){
+ else
light = blend_light(m_env->getDayNightRatio(), LIGHT_SUN, 0);
- }
+
m_light = decode_light(light);
}