ta bort try-catch

This commit is contained in:
loveb 2022-04-21 08:12:51 +02:00
parent e573bed40c
commit f4a2d3a37d

View File

@ -18,14 +18,13 @@ public class Pawn extends PieceKnownIfMoved {
// Kolla ifall vi kan ta någon // Kolla ifall vi kan ta någon
for (int pawnX : new int[]{-1, 1}) { for (int pawnX : new int[]{-1, 1}) {
// Position vi kollar just nu, snett upp åt höger & vänster // Position vi kollar just nu, snett upp åt höger & vänster
try { Point pos = new Point(this.position.x + pawnX, this.position.y + (this.white ? -1 : 1));
Point pos = new Point(this.position.x + pawnX, this.position.y + (this.white ? -1 : 1)); if (pos.x < 0 || pos.x > 7 || pos.y < 0 || pos.y > 7) {
Piece piece = pieces[pos.x][pos.y]; continue;
if (piece == null || piece.white != piece.white) { }
movable.add(pos); Piece piece = pieces[pos.x][pos.y];
} if (piece == null || piece.white != piece.white) {
} catch (Exception e) { movable.add(pos);
// Out of bounds
} }
} }