kida fixed promotion
parent
8cb621d804
commit
64cf321511
|
|
@ -22,7 +22,11 @@ public class ButtonMovePieceListener implements ActionListener {
|
|||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (game.isPromotionMove(this.mv))
|
||||
game.doPromotionMove(this.sf.showPromotion(), mv.getFrom(), mv.getTo());
|
||||
else
|
||||
this.game.playMove(this.mv);
|
||||
|
||||
if (this.game.isDraw()) {
|
||||
this.game.stopClock();
|
||||
this.sf.setBoardMode(BoardMode.finished);
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ public class Game {
|
|||
public void doPromotionMove(int piece, Square origin, Square destination) {
|
||||
System.out.println(piece);
|
||||
Piece promotedTo;
|
||||
switch(piece) {
|
||||
switch (piece) {
|
||||
case 7:
|
||||
promotedTo = Piece.BLACK_KNIGHT;
|
||||
break;
|
||||
|
|
@ -191,12 +191,15 @@ public class Game {
|
|||
promotedTo = Piece.WHITE_QUEEN;
|
||||
}
|
||||
Move promotionMove = new Move(origin, destination, promotedTo);
|
||||
board.doMove(promotionMove);
|
||||
movelist.add(promotionMove);
|
||||
playMove(promotionMove);
|
||||
}
|
||||
|
||||
public String toFEN() {
|
||||
board.toString();
|
||||
return board.getFen();
|
||||
}
|
||||
|
||||
public Square getSelectedSquare() {
|
||||
return this.getSelectedSquare();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue