本文整理汇总了C++中MapCache::getBiomeCount方法的典型用法代码示例。如果您正苦于以下问题:C++ MapCache::getBiomeCount方法的具体用法?C++ MapCache::getBiomeCount怎么用?C++ MapCache::getBiomeCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapCache
的用法示例。
在下文中一共展示了MapCache::getBiomeCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init_biomes
bool VeinGenerator::init_biomes()
{
auto &mats = df::inorganic_raw::get_vector();
materials.resize(world->raws.inorganics.size());
for (size_t i = 0; i < mats.size(); i++)
{
materials[i].can_support_aquifer = mats[i]->flags.is_set(inorganic_flags::AQUIFER);
// Be silent about slade veins, which can happen below hell
if (mats[i]->flags.is_set(inorganic_flags::DEEP_SURFACE))
materials[i].valid_type[0] = -2;
}
biome_by_idx.resize(map.getBiomeCount());
size = df::coord2d(map.maxBlockX()+1, map.maxBlockY()+1);
base = df::coord2d(world->map.region_x*3, world->map.region_y*3);
for (size_t i = 0; i < biome_by_idx.size(); i++)
{
const BiomeInfo &info = map.getBiomeByIndex(i);
if (info.geo_index < 0 || !info.geobiome)
{
out.printerr("Biome %d is not defined.\n", i);
return false;
}
GeoBiome *&biome = biomes[info.geo_index];
if (!biome)
{
biome = new GeoBiome(info, base, size);
if (!biome->init_layers())
return false;
// Mark valid vein types
auto &layers = info.geobiome->layers;
for (size_t i = 0; i < layers.size(); i++)
{
auto layer = layers[i];
for (size_t j = 0; j < layer->vein_mat.size(); j++)
{
if (unsigned(layer->vein_mat[j]) >= materials.size() ||
unsigned(layer->vein_type[j]) >= NUM_INCLUSIONS)
continue;
auto &minfo = materials[layer->vein_mat[j]];
int type = layer->vein_type[j];
minfo.valid_type[type] = type;
if (minfo.default_type < 0 || type == inclusion_type::CLUSTER)
minfo.default_type = type;
}
}
}
biome_by_idx[i] = biome;
}
return true;
}