本文整理汇总了C++中Piece::GetCurrentConfiguration方法的典型用法代码示例。如果您正苦于以下问题:C++ Piece::GetCurrentConfiguration方法的具体用法?C++ Piece::GetCurrentConfiguration怎么用?C++ Piece::GetCurrentConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piece
的用法示例。
在下文中一共展示了Piece::GetCurrentConfiguration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BoardDrawingArea_BoardClicked
void GameTotalAllocationWidget::BoardDrawingArea_BoardClicked(
const Coordinate &a_coord,
const Piece &a_piece,
const Player &a_player)
{
if (a_player.NumberOfPiecesAvailable() == e_numberOfPieces)
{
if ( ( (!a_player.GetStartingCoordinate().Initialised()) &&
(!rules::IsPieceDeployableInStartingPoint(
m_theTotalAllocationGame.GetBoard(),
a_piece.GetCurrentConfiguration(),
a_coord,
a_coord)) ) ||
( (a_player.GetStartingCoordinate().Initialised()) &&
(!rules::IsPieceDeployableInStartingPoint(
m_theTotalAllocationGame.GetBoard(),
a_piece.GetCurrentConfiguration(),
a_coord,
a_player.GetStartingCoordinate())) ) )
{
#ifdef DEBUG_PRINT
std::cout << "Starting coordinate deployment failure: Cheeky you! Don't try to deploy a piece where it's not allowed to"
<< std::endl;
#endif
return;
}
}
else
{
if (!rules::IsPieceDeployableCompute(
m_theTotalAllocationGame.GetBoard(),
a_piece.GetCurrentConfiguration(),
a_coord,
a_player))
{
#ifdef DEBUG_PRINT
std::cout << "Deployment failure: Cheeky you! Don't try to deploy a piece where it's not allowed to"
<< std::endl;
#endif
return;
}
}
// put down current piece before anything else
m_theTotalAllocationGame.PutDownPiece(a_piece, a_coord);
// invalidate the board drawing area to show the new moves
// activating the latest piece deployed glowing effect
m_boardDrawingArea.Invalidate(a_piece, a_coord, a_player);
// update score
m_statusBar.SetScoreStatus(1, a_player);
// remove the actual piece being edited from the edit piece drawing area
// and force the edit piece drawing area to be redraw
m_editPieceTable.SetPiece(e_noPiece);
// update the list of available pieces too
m_pickPiecesDrawingArea.Invalidate();
// there's a few things that have to be done if this player can't put
// down any more pieces
if (rules::CanPlayerGo(m_theTotalAllocationGame.GetBoard(), a_player) == false)
{
GameFinished();
}
}
示例2: BoardDrawingArea_BoardClicked
void GameChallengeWidget::BoardDrawingArea_BoardClicked(
const Coordinate &a_coord,
const Piece &a_piece,
const Player &a_player)
{
if (a_player.GetStartingCoordinate().Initialised() &&
m_theChallengeGame.GetBoard().IsCoordEmpty(a_player.GetStartingCoordinate()))
{
// check if the piece can be deployed on the starting coordinate
// or in any of the available nucleation points
//
// use IsPieceDeployableInCoord instead of IsPieceDeployableInStartingPoint
// so it supports blockem challenges
if ( !rules::IsPieceDeployableInCoord(
m_theChallengeGame.GetBoard(),
a_piece.GetCurrentConfiguration(),
a_coord,
a_player.GetStartingCoordinate(),
a_player) &&
!rules::IsPieceDeployableCompute(
m_theChallengeGame.GetBoard(),
a_piece.GetCurrentConfiguration(),
a_coord,
a_player) )
{
#ifdef DEBUG_PRINT
std::cout << "Cheeky you! Don't try to deploy a piece where it's not allowed to"
<< std::endl;
#endif
return;
}
}
else if (!rules::IsPieceDeployableCompute(
m_theChallengeGame.GetBoard(),
a_piece.GetCurrentConfiguration(),
a_coord,
a_player))
{
#ifdef DEBUG_PRINT
std::cout << "Cheeky you! Don't try to deploy a piece where it's not allowed to"
<< std::endl;
#endif
return;
}
// put down current piece before anything else
m_theChallengeGame.PutDownPiece(a_piece, a_coord);
// invalidate the board drawing area to show the new moves
// activating the latest piece deployed glowing effect
m_boardDrawingArea.Invalidate(a_piece, a_coord, a_player);
// update score
m_statusBar.SetScoreStatus(1, a_player);
// remove the actual piece being edited from the edit piece drawing area
// and force the edit piece drawing area to be redraw
m_editPieceTable.SetPiece(e_noPiece);
// update the list of available pieces too
m_pickPiecesDrawingArea.Invalidate();
// there's a few things that have to be done if this player can't put
// down any more pieces
if (rules::CanPlayerGo(m_theChallengeGame.GetBoard(), a_player) == false)
{
GameFinished();
}
}