本文整理汇总了C++中MapBlock::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ MapBlock::isValid方法的具体用法?C++ MapBlock::isValid怎么用?C++ MapBlock::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapBlock
的用法示例。
在下文中一共展示了MapBlock::isValid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetNextBlocks
//.........这里部分代码省略.........
if(m_blocks_sent.find(p) != m_blocks_sent.end() && m_blocks_sent[p] > 0 && m_blocks_sent[p] + (d <= 2 ? 1 : d*d*d) > m_uptime) {
continue;
}
}
/*
Check if map has this block
*/
MapBlock *block = env->getMap().getBlockNoCreateNoEx(p);
bool surely_not_found_on_disk = false;
bool block_is_invalid = false;
if(block != NULL)
{
if (m_blocks_sent[p] > 0 && m_blocks_sent[p] >= block->m_changed_timestamp) {
continue;
}
// Reset usage timer, this block will be of use in the future.
block->resetUsageTimer();
// Block is dummy if data doesn't exist.
// It means it has been not found from disk and not generated
if(block->isDummy())
{
surely_not_found_on_disk = true;
}
if (block->getLightingExpired()) {
continue;
}
// Block is valid if lighting is up-to-date and data exists
if(block->isValid() == false)
{
block_is_invalid = true;
}
if(block->isGenerated() == false)
{
continue;
}
/*
If block is not close, don't send it unless it is near
ground level.
Block is near ground level if night-time mesh
differs from day-time mesh.
*/
/*
if(d >= 4)
{
if(block->getDayNightDiff() == false)
continue;
}
*/
}
/*
If block has been marked to not exist on disk (dummy)
and generating new ones is not wanted, skip block.
*/
if(generate == false && surely_not_found_on_disk == true)
{
// get next one.
示例2: GetNextBlocks
//.........这里部分代码省略.........
continue;
}
/*
Don't send already sent blocks
*/
{
if(m_blocks_sent.find(p) != m_blocks_sent.end())
{
continue;
}
}
/*
Check if map has this block
*/
MapBlock *block = env->getMap().getBlockNoCreateNoEx(p);
bool surely_not_found_on_disk = false;
bool block_is_invalid = false;
if(block != NULL)
{
// Reset usage timer, this block will be of use in the future.
block->resetUsageTimer();
// Block is dummy if data doesn't exist.
// It means it has been not found from disk and not generated
if(block->isDummy())
{
surely_not_found_on_disk = true;
}
// Block is valid if lighting is up-to-date and data exists
if(block->isValid() == false)
{
block_is_invalid = true;
}
if(block->isGenerated() == false)
block_is_invalid = true;
/*
If block is not close, don't send it unless it is near
ground level.
Block is near ground level if night-time mesh
differs from day-time mesh.
*/
if(d >= 4)
{
if(block->getDayNightDiff() == false)
continue;
}
}
/*
If block has been marked to not exist on disk (dummy)
and generating new ones is not wanted, skip block.
*/
if(generate == false && surely_not_found_on_disk == true)
{
// get next one.
continue;
}
/*
示例3: GetNextBlocks
//.........这里部分代码省略.........
isOccluded(&env->getMap(), spn, cpn + v3POS(bs2,-bs2,bs2),
step, stepfac, startoff, endoff, needed_count, nodemgr, occlude_cache) &&
isOccluded(&env->getMap(), spn, cpn + v3POS(bs2,-bs2,-bs2),
step, stepfac, startoff, endoff, needed_count, nodemgr, occlude_cache) &&
isOccluded(&env->getMap(), spn, cpn + v3POS(-bs2,bs2,bs2),
step, stepfac, startoff, endoff, needed_count, nodemgr, occlude_cache) &&
isOccluded(&env->getMap(), spn, cpn + v3POS(-bs2,bs2,-bs2),
step, stepfac, startoff, endoff, needed_count, nodemgr, occlude_cache) &&
isOccluded(&env->getMap(), spn, cpn + v3POS(-bs2,-bs2,bs2),
step, stepfac, startoff, endoff, needed_count, nodemgr, occlude_cache) &&
isOccluded(&env->getMap(), spn, cpn + v3POS(-bs2,-bs2,-bs2),
step, stepfac, startoff, endoff, needed_count, nodemgr, occlude_cache)
)
{
//infostream<<" occlusion player="<<cam_pos_nodes<<" d="<<d<<" block="<<cpn<<" total="<<blocks_occlusion_culled<<"/"<<num_blocks_selected<<std::endl;
g_profiler->add("SMap: Occlusion skip", 1);
blocks_occlusion_culled++;
continue;
}
}
// Reset usage timer, this block will be of use in the future.
block->resetUsageTimer();
if (block->getLightingExpired()) {
//env->getServerMap().lighting_modified_blocks.set(p, nullptr);
env->getServerMap().lighting_modified_add(p, d);
}
if (block->lighting_broken > 0 && (block_sent || d > 0))
continue;
// Block is valid if lighting is up-to-date and data exists
if(block->isValid() == false)
{
block_is_invalid = true;
}
if(block->isGenerated() == false)
{
continue;
}
/*
If block is not close, don't send it unless it is near
ground level.
Block is near ground level if night-time mesh
differs from day-time mesh.
*/
/*
if(d >= 4)
{
if(block->getDayNightDiff() == false)
continue;
}
*/
}
/*
If block has been marked to not exist on disk (dummy)
and generating new ones is not wanted, skip block.
*/
if(generate == false && surely_not_found_on_disk == true)
{
// get next one.