From: Benjamin Auder Date: Mon, 23 Mar 2020 01:43:44 +0000 (+0100) Subject: Fix notation and pieces setup for random asymmetric in Eightpieces X-Git-Url: https://git.auder.net/doc/html/pieces/img/vendor/index.css?a=commitdiff_plain;h=7e476ce4b299c0a35529b80c730a452992453cc6;p=vchess.git Fix notation and pieces setup for random asymmetric in Eightpieces --- diff --git a/client/src/variants/Eightpieces.js b/client/src/variants/Eightpieces.js index 9ca85956..42df93e3 100644 --- a/client/src/variants/Eightpieces.js +++ b/client/src/variants/Eightpieces.js @@ -175,7 +175,8 @@ export class EightpiecesRules extends ChessRules { if (c == 'b') { // Check if white sentry is on the same color as ours. // If yes: swap bishop and sentry positions. - if ((pieces['w'].indexOf('s') - sentryPos) % 2 == 0) + // NOTE: test % 2 == 1 because there are 7 slashes. + if ((pieces['w'].indexOf('s') - sentryPos) % 2 == 1) [bishopPos, sentryPos] = [sentryPos, bishopPos]; } positions.splice(Math.max(randIndex, randIndex_tmp), 1); @@ -1030,6 +1031,13 @@ export class EightpiecesRules extends ChessRules { if (Object.keys(V.LANCER_DIRNAMES).includes(move.vanish[0].p)) // Lancer: add direction info notation += "=" + V.LANCER_DIRNAMES[move.appear[0].p]; + else if ( + move.vanish[0].p == V.PAWN && + Object.keys(V.LANCER_DIRNAMES).includes(move.appear[0].p) + ) { + // Fix promotions in lancer: + notation = notation.slice(0, -1) + "L:" + V.LANCER_DIRNAMES[move.appear[0].p]; + } return notation; } }; diff --git a/client/src/views/MyGames.vue b/client/src/views/MyGames.vue index 1e1c9e7c..94035287 100644 --- a/client/src/views/MyGames.vue +++ b/client/src/views/MyGames.vue @@ -68,12 +68,9 @@ export default { // Initialize connection this.connexionString = params.socketUrl + - "/?sid=" + - this.st.user.sid + - "&id=" + - this.st.user.id + - "&tmpId=" + - getRandString() + + "/?sid=" + this.st.user.sid + + "&id=" + this.st.user.id + + "&tmpId=" + getRandString() + "&page=" + encodeURIComponent(this.$route.path); this.conn = new WebSocket(this.connexionString);