Fix disconnexion => remove challenges in main Hall
authorBenjamin Auder <benjamin.auder@somewhere>
Thu, 9 Apr 2020 11:04:07 +0000 (13:04 +0200)
committerBenjamin Auder <benjamin.auder@somewhere>
Thu, 9 Apr 2020 11:04:07 +0000 (13:04 +0200)
client/src/translations/rules/Sittuyin/en.pug
client/src/translations/rules/Sittuyin/es.pug
client/src/translations/rules/Sittuyin/fr.pug
client/src/views/Hall.vue

index ab959b8..d9703ac 100644 (file)
@@ -56,6 +56,8 @@ p.
   If you only have one pawn remaining, it can promote from any square.
   Promotion is always in a general, and you can have only one general on the
   board.
   If you only have one pawn remaining, it can promote from any square.
   Promotion is always in a general, and you can have only one general on the
   board.
+  The promoted general cannot attack any opponent's piece, nor can he discover
+  a rook attack on the enemy king.
 
 h3 Source
 
 
 h3 Source
 
index 0a76725..f7a757e 100644 (file)
@@ -59,6 +59,8 @@ p.
   Si solo le queda un peón, puede ser promovido desde cualquier asunto.
   La promoción siempre se realiza en un general, y solo puede tener uno
   general en el tablero de ajedrez.
   Si solo le queda un peón, puede ser promovido desde cualquier asunto.
   La promoción siempre se realiza en un general, y solo puede tener uno
   general en el tablero de ajedrez.
+  El general promovido no debe atacar una pieza contraria, ni descubrir un
+  ataque de la torre al rey enemigo.
 
 h3 Fuente
 
 
 h3 Fuente
 
index c8cad9f..4b6ee43 100644 (file)
@@ -58,6 +58,8 @@ p.
   n'importe quelle case.
   La promotion s'effectue toujours en un général, et vous ne pouvez avoir qu'un
   général sur l'échiquier.
   n'importe quelle case.
   La promotion s'effectue toujours en un général, et vous ne pouvez avoir qu'un
   général sur l'échiquier.
+  Le général promu ne doit pas attaquer une pièce adverse, ni découvrir une
+  attaque de tour sur le roi ennemi.
 
 h3 Source
 
 
 h3 Source
 
index cb08808..ee8d53e 100644 (file)
@@ -681,12 +681,19 @@ export default {
             this.$delete(this.people, data.from[0]);
           else this.$forceUpdate(); //TODO: shouldn't be required
           if (data.code == "disconnect") {
             this.$delete(this.people, data.from[0]);
           else this.$forceUpdate(); //TODO: shouldn't be required
           if (data.code == "disconnect") {
-            // Remove the live challenges sent by this player:
-            ArrayFun.remove(
-              this.challenges,
-              c => c.type == "live" && c.from.sid == data.from[0],
-              "all"
-            );
+            // Remove the live challenges sent by this player, if
+            // he isn't connected on another tab:
+            if (
+              !this.people[data.from[0]] ||
+              Object.values(this.people[data.from[0]].tmpIds)
+                .every(v => v.page != "/")
+            ) {
+              ArrayFun.remove(
+                this.challenges,
+                c => c.type == "live" && c.from.sid == data.from[0],
+                "all"
+              );
+            }
           } else {
             // Remove the matching live game if now unreachable
             const gid = data.page.match(/[a-zA-Z0-9]+$/)[0];
           } else {
             // Remove the matching live game if now unreachable
             const gid = data.page.match(/[a-zA-Z0-9]+$/)[0];