当前位置: 首页>>代码示例>>C++>>正文


C++ BiomeManager类代码示例

本文整理汇总了C++中BiomeManager的典型用法代码示例。如果您正苦于以下问题:C++ BiomeManager类的具体用法?C++ BiomeManager怎么用?C++ BiomeManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BiomeManager类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getServer

// clear_registered_biomes()
int ModApiMapgen::l_clear_registered_biomes(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;

	BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
	bmgr->clear();
	return 0;
}
开发者ID:DarkDracoon,项目名称:minetest,代码行数:9,代码来源:l_mapgen.cpp

示例2: luaL_checktype

// 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;
}
开发者ID:AnnXGame,项目名称:Minetest,代码行数:48,代码来源:l_mapgen.cpp

示例3: BiomeManager

void MapGenerator::CreateBiomes()
{
     BiomeManager* bManager = new BiomeManager();
    bool** check = getArray<bool>(mapSize);
    for(int y =0; y<mapSize; y++)
    {
        for(int x =0; x<mapSize; x++)
        {
            if(!check[x][y])
            {
                //on start un biomes ici, vu que le parser est pas encore passser dessus

                check[x][y]=true;
                BiomesParser((char)map->getBiomesMap()[x][y], (bool**)check, new point(x, y),bManager,bManager->createNewBiome(map->getBiomesMap()[x][y]));
            }
        }
    }
        bManager->generate(map->getBiomesMap(),mapSize);
}
开发者ID:dsapandora,项目名称:getrandomgame,代码行数:19,代码来源:MapGenerator.cpp

示例4: luaL_checktype

// 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;
}
开发者ID:t0suj4,项目名称:minetest,代码行数:22,代码来源:l_mapgen.cpp

示例5: lua_tostring

// get_biome_id(biomename)
// returns the biome id used in biomemap
int ModApiMapgen::l_get_biome_id(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;

	const char *biome_str = lua_tostring(L, 1);
	if (!biome_str)
		return 0;

	BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;

	if (!bmgr)
		return 0;

	Biome *biome = (Biome *)bmgr->getByName(biome_str);

	if (!biome || biome->index == OBJDEF_INVALID_INDEX)
		return 0;

	lua_pushinteger(L, biome->index);

	return 1;
}
开发者ID:DarkDracoon,项目名称:minetest,代码行数:24,代码来源:l_mapgen.cpp

示例6: read_v3s16

// get_humidity(pos)
// returns the humidity at the position
int ModApiMapgen::l_get_humidity(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;

	v3s16 pos = read_v3s16(L, 1);

	NoiseParams np_humidity;
	NoiseParams np_humidity_blend;

	MapSettingsManager *settingsmgr =
		getServer(L)->getEmergeManager()->map_settings_mgr;

	if (!settingsmgr->getMapSettingNoiseParams("mg_biome_np_humidity",
			&np_humidity) ||
			!settingsmgr->getMapSettingNoiseParams("mg_biome_np_humidity_blend",
			&np_humidity_blend))
		return 0;

	std::string value;
	if (!settingsmgr->getMapSetting("seed", &value))
		return 0;
	std::istringstream ss(value);
	u64 seed;
	ss >> seed;

	BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
	if (!bmgr)
		return 0;

	float humidity = bmgr->getHumidityAtPosOriginal(pos, np_humidity,
		np_humidity_blend, seed);
	if (!humidity)
		return 0;

	lua_pushnumber(L, humidity);

	return 1;
}
开发者ID:Sokomine,项目名称:minetest,代码行数:40,代码来源:l_mapgen.cpp


注:本文中的BiomeManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。