本文整理汇总了C++中Stone::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ Stone::getType方法的具体用法?C++ Stone::getType怎么用?C++ Stone::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stone
的用法示例。
在下文中一共展示了Stone::getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isCanMove
bool GameScene::isCanMove(int moveID, int killID, int tox, int toy){
/*根据要移动的棋子的类型来分别判断*/
Stone* moveStone = sts[moveID];
switch (moveStone->getType()){
case Stone::JIANG:
return canMoveJIANG(moveID, killID, tox, toy);
case Stone::SHI:
return canMoveSHI(moveID, tox, toy);
case Stone::XIANG:
return canMoveXIANG(moveID, killID, tox, toy);
case Stone::JU:
return canMoveJU(moveID, killID, tox, toy);
case Stone::MA:
return canMoveMA(moveID, killID, tox, toy);
case Stone::PAO:
return canMovePAO(moveID, killID, tox, toy);
case Stone::BING:
return canMoveBING(moveID, killID, tox, toy);
default:return false;
}
}
示例2: canMove
//判断棋子是否符合行棋规则
bool FourthScene::canMove(int ids,int x ,int y)
{
//获得选中的棋子
Stone* s = _s4[ids];
//棋子的类型
switch(s->getType())
{
//王的走棋规则
case Stone::WANG:
{
return canMoveWang(ids, x, y);
}
break;
//忍的走棋规则
case Stone::REN:
{
return canMoveRen(ids, x, y);
}
break;
//寨的走棋规则
case Stone::ZHAI:
{
return canMoveZhai(ids, x, y);
}
break;
//大的走棋规则
case Stone::DA:
{
return canMoveDa(ids, x, y);
}
break;
//马的走棋规则
case Stone::MA:
{
return canMoveMa(ids, x, y);
}
break;
//筒的走棋规则
case Stone::TONG:
{
return canMoveTong(ids, x, y);
}
break;
//炮的走棋规则
case Stone::PAO:
{
return canMovePao(ids, x, y);
}
break;
//弓的走棋规则
case Stone::GONG:
{
return canMoveGone(ids, x, y);
}
break;
//小的走棋规则
case Stone::XIAO:
{
return canMoveXiao(ids, x, y);
}
break;
//中的走棋规则
case Stone::ZHONG:
{
return canMoveZhong(ids, x, y);
}
break;
//兵的走棋规则
case Stone::BING:
{
return canMoveBing(ids, x, y);
}
break;
default:
{
break;
}
}
return false;
}