本文整理汇总了C++中CBlock::isMarked方法的典型用法代码示例。如果您正苦于以下问题:C++ CBlock::isMarked方法的具体用法?C++ CBlock::isMarked怎么用?C++ CBlock::isMarked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBlock
的用法示例。
在下文中一共展示了CBlock::isMarked方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkNearestForDigging
GLvoid CImp::checkNearestForDigging()
{
if(impState != IS_IDLE) return;
std::vector<CBlock*> markedBlocks,possBlocks;
std::vector<CBlock*>::iterator markedBlocksIter;
CBlock *block;
if(CV_GAME_MANAGER->getLevelManager()->isBlockTypeNear(CV_BLOCK_TYPE_EARTH_ID,cml::vector2i((int)floor(position[0]/CV_BLOCK_WIDTH),(int)floor(position[2]/CV_BLOCK_DEPTH)),true,CV_PLAYER_UNDEFINED,&markedBlocks))
{
int oldSearchLimit = CV_GAME_MANAGER->getPathManager()->getSearchLimit();
CV_GAME_MANAGER->getPathManager()->setSearchLimit(2);
bool oldDiagonalMoves = CV_GAME_MANAGER->getPathManager()->getDiagonalMoves();
CV_GAME_MANAGER->getPathManager()->setDiagonalMoves(false);
for(markedBlocksIter=markedBlocks.begin(); markedBlocksIter!=markedBlocks.end(); markedBlocksIter++)
{
block = *markedBlocksIter;
if(!block->isMarked())
continue;
path.clear();
if(CV_GAME_MANAGER->getPathManager()->findPath(cml::vector2i((int)floor(position[0]/CV_BLOCK_WIDTH),(int)floor(position[2]/CV_BLOCK_DEPTH)),block->getLogicalPosition(),&path))
possBlocks.push_back(block);
}
CV_GAME_MANAGER->getPathManager()->setSearchLimit(oldSearchLimit);
CV_GAME_MANAGER->getPathManager()->setDiagonalMoves(oldDiagonalMoves);
if(possBlocks.size()>0)
{
GLint blockNum = rand()%possBlocks.size();
currBlock = possBlocks[blockNum];
path.clear();
impState = IS_AT_DIGGING_BLOCK;
return;
}
}
}