本文整理汇总了C++中Pipe::back方法的典型用法代码示例。如果您正苦于以下问题:C++ Pipe::back方法的具体用法?C++ Pipe::back怎么用?C++ Pipe::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pipe
的用法示例。
在下文中一共展示了Pipe::back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CoordinateReleased
void GameController::CoordinateReleased()
{
for(int i=0;i<getLevel();++i)
for(int j=0;j<getLevel();++j)
setBlockColor(QPoint(i,j),GameData::BgColor);
for(int i=0;i<getColorNumber()*2;++i)
setBlockColor(gameSetting->Points[i],GameData::ColorSet[i/2]);
for(int i=0;i<pipeManager->size();++i)
{
Pipe* pipe = pipeManager->at(i);
if(pipeManager->currentPipe!=pipe)
{
while(!pipe->empty())
{
QPoint _coordinate(pipe->back());
STATE _state = getBlockState(_coordinate);
if((_state&WAY)==0||(_state&BREAK)!=0||(_state&CURRENT)!=0)
pipe->pop_back();
else
break;
}
}
for(int j=0;j<pipe->size();++j)
setBlockColor(pipe->at(j),pipe->Color);
}
for(int i=0;i<this->getLevel();++i)
for(int j=0;j<this->getLevel();++j)
setBlockState(QPoint(i,j),~(CURRENT|BREAK));
++gameSetting->moves;
emit UpdatePipeDisplay();
emit UpdateBlockDisplay();
if(CheckWin())
emit CompleteGame();
}
示例2: CoordinateSelected
void GameController::CoordinateSelected(const QPoint &_coordinate)
{
this->pipeManager->currentPipe = this->pipeManager->getPipe(this->getBlockColor(_coordinate));
Pipe* pipe = pipeManager->currentPipe;
while(!pipe->empty() && (pipe->back()!=_coordinate||(getBlockState(_coordinate)&ORIGIN)!=0))
{
setBlockState(pipe->back(),~(WAY|CURRENT));
pipe->pop_back();
}
if(pipe->empty())
{
setBlockState(_coordinate,WAY|CURRENT);
pipe->push_back(_coordinate);
}
for(int i=0;i<pipe->size();++i)
setBlockState(pipe->at(i),CURRENT);
emit UpdatePipeDisplay();
}
示例3: CheckWin
bool GameController::CheckWin()
{
for(int i=0;i<pipeManager->size();++i)
{
Pipe* pipe = pipeManager->at(i);
if(pipe->size()<2)
return false;
if((getBlockState(pipe->back())&ORIGIN)==0)
return false;
}
for(int i=0;i<getLevel();++i)
for(int j=0;j<getLevel();++j)
if((getBlockState(QPoint(i,j))&WAY)==0)
return false;
if(gameSetting->best<=0 || gameSetting->moves<gameSetting->best)
gameSetting->setBest(gameSetting->moves);
return true;
}
示例4: GameStateRecalculate
void GameController::GameStateRecalculate()
{
int pipeCompleteCount = 0;
for(int i=0;i<getLevel();++i)
for(int j=0;j<getLevel();++j)
if((blockstate[i][j]&WAY)!=0)
++pipeCompleteCount;
gameSetting->pipeFilled = floor(pipeCompleteCount*100/getLevel()/getLevel());
int pipeLinkCount = 0;
for(int i=0;i<pipeManager->size();++i)
{
Pipe* pipe = pipeManager->at(i);
if(pipe->size()<2)
continue;
if((getBlockState(pipe->back())&ORIGIN)==0)
continue;
++pipeLinkCount;
}
gameSetting->currentflows = pipeLinkCount;
}