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:
parent
92815ad54b
commit
5b8855e83c
12 changed files with 429 additions and 455 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue