diff options
author | Loïc Blot <loic.blot@unix-experience.fr> | 2019-03-25 16:38:35 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2019-03-31 20:49:39 +0200 |
commit | b3716a03a6d47058b50acfc71c861ecfea5f80ad (patch) | |
tree | 613b338e137c1bd5e30c3664eb418f2bd18d00c0 /src/emerge.cpp | |
parent | ab322fc5aa0b81375aa1d5b2e9b0a0872eecb26f (diff) | |
download | minetest-b3716a03a6d47058b50acfc71c861ecfea5f80ad.tar.gz minetest-b3716a03a6d47058b50acfc71c861ecfea5f80ad.tar.bz2 minetest-b3716a03a6d47058b50acfc71c861ecfea5f80ad.zip |
EmergeManager::initMapgens use FATAL_ERROR if and drop boolean return
We never handle the boolean return, also init twice is a coding error, not a runtime error
Diffstat (limited to 'src/emerge.cpp')
-rw-r--r-- | src/emerge.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/emerge.cpp b/src/emerge.cpp index 0a1852985..9b3394a23 100644 --- a/src/emerge.cpp +++ b/src/emerge.cpp @@ -184,33 +184,28 @@ EmergeManager::~EmergeManager() } -bool EmergeManager::initMapgens(MapgenParams *params) +void EmergeManager::initMapgens(MapgenParams *params) { - if (!m_mapgens.empty()) - return false; - - this->mgparams = params; + FATAL_ERROR_IF(!m_mapgens.empty(), "mapgen already inited."); - for (u32 i = 0; i != m_threads.size(); i++) { - Mapgen *mg = Mapgen::createMapgen(params->mgtype, i, params, this); - m_mapgens.push_back(mg); - } + mgparams = params; - return true; + for (u32 i = 0; i != m_threads.size(); i++) + m_mapgens.push_back(Mapgen::createMapgen(params->mgtype, i, params, this)); } Mapgen *EmergeManager::getCurrentMapgen() { if (!m_threads_active) - return NULL; + return nullptr; for (u32 i = 0; i != m_threads.size(); i++) { if (m_threads[i]->isCurrentThread()) return m_threads[i]->m_mapgen; } - return NULL; + return nullptr; } |