From 5b8855e83c0d1cc7aef21492e7fe862b7d06917e Mon Sep 17 00:00:00 2001 From: Craig Robbins Date: Fri, 14 Nov 2014 18:05:34 +1000 Subject: Remove most exceptions from getNode() (and variants) --- src/content_cso.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/content_cso.cpp') 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); } -- cgit v1.2.3