MCPcopy Create free account
hub / github.com/XMuli/ChineseChess / canMoveMA

Method canMoveMA

ChessBoard.cpp:838–858  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

836}
837
838bool ChessBoard::canMoveMA(int moveId, int killId, int row, int col)
839{
840 Q_UNUSED(killId);
841 int d=relation(m_ChessPieces[moveId].m_nRow, m_ChessPieces[moveId].m_nCol, row, col);
842 if(d!=12 && d!=21)
843 return false;
844
845 //蹩马脚
846 if(d==12)
847 {
848 if(getStoneId(m_ChessPieces[moveId].m_nRow, (m_ChessPieces[moveId].m_nCol+ col) /2) != -1)
849 return false;
850 }
851 else
852 {
853 if(getStoneId((m_ChessPieces[moveId].m_nRow+ row) /2 ,m_ChessPieces[moveId].m_nCol) != -1)
854 return false;
855 }
856
857 return true;
858}
859
860bool ChessBoard::canMoveCHE(int moveId, int killId, int row, int col)
861{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected