Maybe we can finally get rid of these code bits which shouldn't be required ?
authorBenjamin Auder <benjamin.auder@somewhere>
Thu, 2 Jun 2022 19:01:10 +0000 (21:01 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Thu, 2 Jun 2022 19:01:10 +0000 (21:01 +0200)
base_rules.js

index f73700b..0d7b703 100644 (file)
@@ -2154,9 +2154,7 @@ export default class ChessRules {
 
   playVisual(move, r) {
     move.vanish.forEach(v => {
-      // TODO: next "if" shouldn't be required
-      if (this.g_pieces[v.x][v.y])
-        this.g_pieces[v.x][v.y].remove();
+      this.g_pieces[v.x][v.y].remove();
       this.g_pieces[v.x][v.y] = null;
     });
     let chessboard =
@@ -2203,10 +2201,6 @@ export default class ChessRules {
       return;
     }
     let initPiece = this.getDomPiece(move.start.x, move.start.y);
-    if (!initPiece) { //TODO this shouldn't be required
-      callback();
-      return;
-    }
     // NOTE: cloning generally not required, but light enough, and simpler
     let movingPiece = initPiece.cloneNode();
     initPiece.style.opacity = "0";