DroidFish: In "sticky" edit board mode, if the target square already contains the selected piece, clear the square instead of doing nothing.

This commit is contained in:
Peter Osterlund 2012-01-26 18:43:53 +00:00
parent 72b93358af
commit 5e4c179ca7

View File

@ -203,8 +203,12 @@ public class EditBoard extends Activity {
} else { } else {
piece = -(m.from + 2); piece = -(m.from + 2);
} }
if (m.to >= 0) if (m.to >= 0) {
pos.setPiece(m.to, piece); if ((m.from < 0) && (pos.getPiece(m.to) == piece))
pos.setPiece(m.to, Piece.EMPTY);
else
pos.setPiece(m.to, piece);
}
if (m.from >= 0) if (m.from >= 0)
pos.setPiece(m.from, Piece.EMPTY); pos.setPiece(m.from, Piece.EMPTY);
cb.setPosition(pos); cb.setPosition(pos);