summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorJozef Behran <jozuejozef@gmail.com>2019-08-13 19:58:27 +0200
committerSmallJoker <SmallJoker@users.noreply.github.com>2019-08-13 19:58:27 +0200
commit72b7a957af331c7481a60705d1a35a78b5afb494 (patch)
treeab862023f10383403daa2962f087d0890e187e76 /src/client
parent539f016c1b1a706da2c113435ec60bb39c868f4b (diff)
downloadminetest-72b7a957af331c7481a60705d1a35a78b5afb494.tar.gz
minetest-72b7a957af331c7481a60705d1a35a78b5afb494.tar.bz2
minetest-72b7a957af331c7481a60705d1a35a78b5afb494.zip
Fix unnecessary exception use in Map::getSectorXXX (#8792)
The Map::getSectorNoGenerate throws an exception but no other code is really dependent on that. Fix the odd instance of misuse in ClientMap::emergeSector and remove the exception throwing version of the method along with the "NoEx" suffixes in the names of these methods.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/clientmap.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/client/clientmap.cpp b/src/client/clientmap.cpp
index 8a182b14a..15fa45940 100644
--- a/src/client/clientmap.cpp
+++ b/src/client/clientmap.cpp
@@ -63,14 +63,13 @@ ClientMap::ClientMap(
MapSector * ClientMap::emergeSector(v2s16 p2d)
{
// Check that it doesn't exist already
- try {
- return getSectorNoGenerate(p2d);
- } catch(InvalidPositionException &e) {
- }
+ MapSector *sector = getSectorNoGenerate(p2d);
- // Create a sector
- MapSector *sector = new MapSector(this, p2d, m_gamedef);
- m_sectors[p2d] = sector;
+ // Create it if it does not exist yet
+ if (!sector) {
+ sector = new MapSector(this, p2d, m_gamedef);
+ m_sectors[p2d] = sector;
+ }
return sector;
}