mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 10:03:45 +01:00
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
This commit is contained in:
parent
ab322fc5aa
commit
b3716a03a6
@ -184,33 +184,28 @@ EmergeManager::~EmergeManager()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EmergeManager::initMapgens(MapgenParams *params)
|
void EmergeManager::initMapgens(MapgenParams *params)
|
||||||
{
|
{
|
||||||
if (!m_mapgens.empty())
|
FATAL_ERROR_IF(!m_mapgens.empty(), "mapgen already inited.");
|
||||||
return false;
|
|
||||||
|
|
||||||
this->mgparams = params;
|
mgparams = params;
|
||||||
|
|
||||||
for (u32 i = 0; i != m_threads.size(); i++) {
|
for (u32 i = 0; i != m_threads.size(); i++)
|
||||||
Mapgen *mg = Mapgen::createMapgen(params->mgtype, i, params, this);
|
m_mapgens.push_back(Mapgen::createMapgen(params->mgtype, i, params, this));
|
||||||
m_mapgens.push_back(mg);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Mapgen *EmergeManager::getCurrentMapgen()
|
Mapgen *EmergeManager::getCurrentMapgen()
|
||||||
{
|
{
|
||||||
if (!m_threads_active)
|
if (!m_threads_active)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
for (u32 i = 0; i != m_threads.size(); i++) {
|
for (u32 i = 0; i != m_threads.size(); i++) {
|
||||||
if (m_threads[i]->isCurrentThread())
|
if (m_threads[i]->isCurrentThread())
|
||||||
return m_threads[i]->m_mapgen;
|
return m_threads[i]->m_mapgen;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public:
|
|||||||
~EmergeManager();
|
~EmergeManager();
|
||||||
DISABLE_CLASS_COPY(EmergeManager);
|
DISABLE_CLASS_COPY(EmergeManager);
|
||||||
|
|
||||||
bool initMapgens(MapgenParams *mgparams);
|
void initMapgens(MapgenParams *mgparams);
|
||||||
|
|
||||||
void startThreads();
|
void startThreads();
|
||||||
void stopThreads();
|
void stopThreads();
|
||||||
|
Loading…
Reference in New Issue
Block a user