diff options
author | Craig Robbins <kde.psych@gmail.com> | 2014-11-14 18:05:34 +1000 |
---|---|---|
committer | Craig Robbins <kde.psych@gmail.com> | 2014-11-14 18:05:34 +1000 |
commit | 5b8855e83c0d1cc7aef21492e7fe862b7d06917e (patch) | |
tree | b05139dcea07222cfa3fab23064eeef0076c8019 /src/particles.cpp | |
parent | 92815ad54b23fe92742ebca7263bb227149248c1 (diff) | |
download | minetest-5b8855e83c0d1cc7aef21492e7fe862b7d06917e.tar.gz minetest-5b8855e83c0d1cc7aef21492e7fe862b7d06917e.tar.bz2 minetest-5b8855e83c0d1cc7aef21492e7fe862b7d06917e.zip |
Remove most exceptions from getNode() (and variants)
Diffstat (limited to 'src/particles.cpp')
-rw-r--r-- | src/particles.cpp | 21 |
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); } |