summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authorJozef Behran <jozuejozef@gmail.com>2019-08-13 20:02:50 +0200
committerSmallJoker <SmallJoker@users.noreply.github.com>2019-08-13 20:02:50 +0200
commitbf22184d6e16f21b9001322aad1bf8f6dbaa372b (patch)
treea1650bf7d3fc0cd756a9bbda07b28480b3f6c439 /src/map.cpp
parent72b7a957af331c7481a60705d1a35a78b5afb494 (diff)
downloadminetest-bf22184d6e16f21b9001322aad1bf8f6dbaa372b.tar.gz
minetest-bf22184d6e16f21b9001322aad1bf8f6dbaa372b.tar.bz2
minetest-bf22184d6e16f21b9001322aad1bf8f6dbaa372b.zip
Fix unnecessary exception use in 3 more methods (#8791)
* Fix unnecessary exception use in Server::SendBlocks The code in this method calls getBlockNoCreate and then messes around with try...catch to skip blocks which are not in the memory. Additionally, it repeatedly calls m_env.getMap() inside this loop. Speed the code up by extracting the m_env.getMap() out of the loop and getting rid of the try...catch. * Fix unnecessary exception use in Server::SendBlock Another unnecessary try...catch is slowing down Server::SendBlock. Remove that to speed it up and get a nice side effect of simplifying the code in question. * Fix unnecessary exception use in MMVManip::initialEmerge Remove another unneeded exception usage from MMVManip::initialEmerge to speed that code up and simplify it but be careful to not remove the braces as there is a TimeTaker in use there.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 2ccd6fd1c..ebf443818 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -2214,20 +2214,15 @@ void MMVManip::initialEmerge(v3s16 blockpos_min, v3s16 blockpos_max,
continue;
bool block_data_inexistent = false;
- try
{
TimeTaker timer2("emerge load", &emerge_load_time);
- block = m_map->getBlockNoCreate(p);
- if(block->isDummy())
+ block = m_map->getBlockNoCreateNoEx(p);
+ if (!block || block->isDummy())
block_data_inexistent = true;
else
block->copyTo(*this);
}
- catch(InvalidPositionException &e)
- {
- block_data_inexistent = true;
- }
if(block_data_inexistent)
{