summaryrefslogtreecommitdiff
path: root/src/content_cso.cpp
diff options
context:
space:
mode:
authorCraig Robbins <kde.psych@gmail.com>2014-11-14 18:05:34 +1000
committerCraig Robbins <kde.psych@gmail.com>2014-11-14 18:05:34 +1000
commit5b8855e83c0d1cc7aef21492e7fe862b7d06917e (patch)
treeb05139dcea07222cfa3fab23064eeef0076c8019 /src/content_cso.cpp
parent92815ad54b23fe92742ebca7263bb227149248c1 (diff)
downloadminetest-5b8855e83c0d1cc7aef21492e7fe862b7d06917e.tar.gz
minetest-5b8855e83c0d1cc7aef21492e7fe862b7d06917e.tar.bz2
minetest-5b8855e83c0d1cc7aef21492e7fe862b7d06917e.zip
Remove most exceptions from getNode() (and variants)
Diffstat (limited to 'src/content_cso.cpp')
-rw-r--r--src/content_cso.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/content_cso.cpp b/src/content_cso.cpp
index 4f652a8a3..4779b20d1 100644
--- a/src/content_cso.cpp
+++ b/src/content_cso.cpp
@@ -60,13 +60,12 @@ public:
m_spritenode->setVisible(true);
m_spritenode->setSize(size);
/* Update brightness */
- u8 light = 64;
- try{
- MapNode n = env->getMap().getNode(floatToInt(pos, BS));
- light = decode_light(n.getLightBlend(env->getDayNightRatio(),
- env->getGameDef()->ndef()));
- }
- catch(InvalidPositionException &e){}
+ u8 light;
+ bool pos_ok;
+ MapNode n = env->getMap().getNodeNoEx(floatToInt(pos, BS), &pos_ok);
+ light = pos_ok ? decode_light(n.getLightBlend(env->getDayNightRatio(),
+ env->getGameDef()->ndef()))
+ : 64;
video::SColor color(255,light,light,light);
m_spritenode->setColor(color);
}