本文整理汇总了C++中BiomeManager::add方法的典型用法代码示例。如果您正苦于以下问题:C++ BiomeManager::add方法的具体用法?C++ BiomeManager::add怎么用?C++ BiomeManager::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BiomeManager
的用法示例。
在下文中一共展示了BiomeManager::add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: l_register_biome
// register_biome({lots of stuff})
int ModApiMapgen::l_register_biome(lua_State *L)
{
int index = 1;
luaL_checktype(L, index, LUA_TTABLE);
INodeDefManager *ndef = getServer(L)->getNodeDefManager();
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
enum BiomeType biometype = (BiomeType)getenumfield(L, index, "type",
es_BiomeTerrainType, BIOME_TYPE_NORMAL);
Biome *b = bmgr->create(biometype);
b->name = getstringfield_default(L, index, "name", "");
b->depth_top = getintfield_default(L, index, "depth_top", 1);
b->depth_filler = getintfield_default(L, index, "depth_filler", 3);
b->height_shore = getintfield_default(L, index, "height_shore", 3);
b->depth_water_top = getintfield_default(L, index, "depth_water_top", 0);
b->y_min = getintfield_default(L, index, "y_min", -31000);
b->y_max = getintfield_default(L, index, "y_max", 31000);
b->heat_point = getfloatfield_default(L, index, "heat_point", 0.f);
b->humidity_point = getfloatfield_default(L, index, "humidity_point", 0.f);
b->flags = 0; //reserved
u32 id = bmgr->add(b);
if (id == (u32)-1) {
delete b;
return 0;
}
NodeResolveInfo *nri = new NodeResolveInfo(b);
std::list<std::string> &nnames = nri->nodenames;
nnames.push_back(getstringfield_default(L, index, "node_top", ""));
nnames.push_back(getstringfield_default(L, index, "node_filler", ""));
nnames.push_back(getstringfield_default(L, index, "node_shore_top", ""));
nnames.push_back(getstringfield_default(L, index, "node_shore_filler", ""));
nnames.push_back(getstringfield_default(L, index, "node_underwater", ""));
nnames.push_back(getstringfield_default(L, index, "node_stone", ""));
nnames.push_back(getstringfield_default(L, index, "node_water_top", ""));
nnames.push_back(getstringfield_default(L, index, "node_water", ""));
nnames.push_back(getstringfield_default(L, index, "node_dust", ""));
ndef->pendNodeResolve(nri);
verbosestream << "register_biome: " << b->name << std::endl;
lua_pushinteger(L, id);
return 1;
}
示例2: l_register_biome
// register_biome({lots of stuff})
int ModApiMapgen::l_register_biome(lua_State *L)
{
int index = 1;
luaL_checktype(L, index, LUA_TTABLE);
INodeDefManager *ndef = getServer(L)->getNodeDefManager();
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
Biome *biome = read_biome_def(L, index, ndef);
if (!biome)
return 0;
ObjDefHandle handle = bmgr->add(biome);
if (handle == OBJDEF_INVALID_HANDLE) {
delete biome;
return 0;
}
lua_pushinteger(L, handle);
return 1;
}