总的移动规则
| 726 | |
| 727 | //总的移动规则 |
| 728 | bool ChessBoard::canMove(int moveId, int killId, int row, int col) |
| 729 | { |
| 730 | //选棋id和吃棋id同色,则选择其它棋子并返回 |
| 731 | if(sameColor(moveId,killId)) |
| 732 | { |
| 733 | //换选棋子 |
| 734 | m_nSelectID=killId; |
| 735 | update(); |
| 736 | return false; |
| 737 | } |
| 738 | |
| 739 | switch (m_ChessPieces[moveId].m_emType) |
| 740 | { |
| 741 | case ChessPieces::JIANG: |
| 742 | return canMoveJIANG(moveId, killId, row, col); |
| 743 | |
| 744 | case ChessPieces::SHI: |
| 745 | return canMoveSHI(moveId, killId, row, col); |
| 746 | |
| 747 | case ChessPieces::XIANG: |
| 748 | return canMoveXIANG(moveId, killId, row, col); |
| 749 | |
| 750 | case ChessPieces::MA: |
| 751 | return canMoveMA(moveId, killId, row, col); |
| 752 | |
| 753 | case ChessPieces::CHE: |
| 754 | return canMoveCHE(moveId, killId, row, col); |
| 755 | |
| 756 | case ChessPieces::PAO: |
| 757 | return canMovePAO(moveId, killId, row, col); |
| 758 | |
| 759 | case ChessPieces::BING: |
| 760 | return canMoveBING(moveId, killId, row, col); |
| 761 | |
| 762 | default: break; |
| 763 | } |
| 764 | |
| 765 | return false; |
| 766 | } |
| 767 | |
| 768 | bool ChessBoard::canMoveJIANG(int moveId, int killId, int row, int col) |
| 769 | { |
nothing calls this directly
no outgoing calls
no test coverage detected