1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +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

@ -251,9 +251,13 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
for(s16 z = min_z; z <= max_z; z++)
{
v3s16 p(x,y,z);
try{
bool is_position_valid;
MapNode n = map->getNodeNoEx(p, &is_position_valid);
if (is_position_valid) {
// Object collides into walkable nodes
MapNode n = map->getNode(p);
const ContentFeatures &f = gamedef->getNodeDefManager()->get(n);
if(f.walkable == false)
continue;
@ -275,8 +279,7 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
is_object.push_back(false);
}
}
catch(InvalidPositionException &e)
{
else {
// Collide with unloaded nodes
aabb3f box = getNodeBox(p, BS);
cboxes.push_back(box);