Fix SQL query to get completed games
[vchess.git] / client / src / base_rules.js
index 890601d..752d8ee 100644 (file)
@@ -73,6 +73,11 @@ export const ChessRules = class ChessRules {
     return V.CanFlip;
   }
 
+  static get IMAGE_EXTENSION() {
+    // All pieces should be in the SVG format
+    return ".svg";
+  }
+
   // Turn "wb" into "B" (for FEN)
   static board2fen(b) {
     return b[0] == "w" ? b[1].toUpperCase() : b[1];
@@ -238,9 +243,11 @@ export const ChessRules = class ChessRules {
 
   // On which squares is color under check ? (for interface)
   getCheckSquares(color) {
-    return this.isAttacked(this.kingPos[color], [V.GetOppCol(color)])
-      ? [JSON.parse(JSON.stringify(this.kingPos[color]))] //need to duplicate!
-      : [];
+    return (
+      this.underCheck(color)
+        ? [JSON.parse(JSON.stringify(this.kingPos[color]))] //need to duplicate!
+        : []
+    );
   }
 
   /////////////