本文整理汇总了C++中MapgenFactory类的典型用法代码示例。如果您正苦于以下问题:C++ MapgenFactory类的具体用法?C++ MapgenFactory怎么用?C++ MapgenFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MapgenFactory类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMapgenFactory
void EmergeManager::initMapgens()
{
if (m_mapgens.size())
return;
MapgenFactory *mgfactory = getMapgenFactory(params.mg_name);
if (!mgfactory) {
errorstream << "EmergeManager: mapgen " << params.mg_name <<
" not registered; falling back to " << DEFAULT_MAPGEN << std::endl;
params.mg_name = DEFAULT_MAPGEN;
mgfactory = getMapgenFactory(params.mg_name);
FATAL_ERROR_IF(mgfactory == NULL, "Couldn't use any mapgen!");
}
if (!params.sparams) {
params.sparams = mgfactory->createMapgenParams();
params.sparams->readParams(g_settings);
}
for (u32 i = 0; i != m_threads.size(); i++) {
Mapgen *mg = mgfactory->createMapgen(i, ¶ms, this);
m_mapgens.push_back(mg);
}
}
示例2:
MapgenSpecificParams *EmergeManager::createMapgenParams(std::string mgname) {
std::map<std::string, MapgenFactory *>::const_iterator iter;
iter = mglist.find(mgname);
if (iter == mglist.end()) {
errorstream << "EmergeManager: mapgen " << mgname <<
" not registered" << std::endl;
return NULL;
}
MapgenFactory *mgfactory = iter->second;
return mgfactory->createMapgenParams();
}
示例3:
MapgenSpecificParams *EmergeManager::createMapgenParams(const std::string &mgname)
{
u32 i;
for (i = 0; i < ARRLEN(reg_mapgens) && mgname != reg_mapgens[i].name; i++);
if (i == ARRLEN(reg_mapgens)) {
errorstream << "EmergeManager: Mapgen " << mgname <<
" not registered" << std::endl;
return NULL;
}
MapgenFactory *mgfactory = reg_mapgens[i].factory;
return mgfactory->createMapgenParams();
}