1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Remove most exceptions from getNode() (and variants)

This commit is contained in:
Craig Robbins 2014-11-14 18:05:34 +10:00
parent 92815ad54b
commit 5b8855e83c
12 changed files with 429 additions and 455 deletions

View file

@ -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);
}