1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 00:25:19 +02:00

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.
This commit is contained in:
Jozef Behran
2019-08-13 19:58:27 +02:00
committed by SmallJoker
parent 539f016c1b
commit 72b7a957af
3 changed files with 13 additions and 25 deletions

View File

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