| 884 | } |
| 885 | |
| 886 | bool ChessBoard::canMoveBING(int moveId, int killId, int row, int col) |
| 887 | { |
| 888 | Q_UNUSED(killId); |
| 889 | int d=relation(m_ChessPieces[moveId].m_nRow, m_ChessPieces[moveId].m_nCol, row, col); |
| 890 | if(d!= 1 && d!= 10) |
| 891 | return false; |
| 892 | |
| 893 | if(isRed(moveId)) //红 |
| 894 | { |
| 895 | //兵卒不可后退 |
| 896 | if(row> m_ChessPieces[moveId].m_nRow) |
| 897 | return false; |
| 898 | |
| 899 | //兵卒没过河不可横着走 |
| 900 | if(m_ChessPieces[moveId].m_nRow>= 5 && m_ChessPieces[moveId].m_nRow== row) |
| 901 | return false; |
| 902 | } |
| 903 | else //黑 |
| 904 | { |
| 905 | if(row< m_ChessPieces[moveId].m_nRow) |
| 906 | return false; |
| 907 | if(m_ChessPieces[moveId].m_nRow<= 4 && m_ChessPieces[moveId].m_nRow== row) |
| 908 | return false; |
| 909 | } |
| 910 | |
| 911 | return true; |
| 912 | } |
| 913 | |
| 914 | bool ChessBoard:: canSelect(int id) |
| 915 | { |
nothing calls this directly
no outgoing calls
no test coverage detected