From: Benjamin Auder Date: Tue, 13 Apr 2021 10:29:46 +0000 (+0200) Subject: A few bug fixes X-Git-Url: https://git.auder.net/variants/Cwda/%7B%7B%20asset%28%27mixstore/images/doc/rpsls.js?a=commitdiff_plain;h=7c4601d007042510ea2aad95a081d6fe83aab938;p=vchess.git A few bug fixes --- diff --git a/TODO b/TODO index 473ea2d0..84859849 100644 --- a/TODO +++ b/TODO @@ -6,14 +6,6 @@ If new live game starts in background, "new game" notify OK but not first move. Will be used for variants with custom non-rectangular board (Hex, at least) Or, with other board shapes (see greenchess.net for example) -debug import game + load - -TODEBUG: Avalanche computer play from here -game.fen = "r2q1bnr/3pp3/n3k1p1/6Pp/3p1B1P/p5R1/1p6/4K1NR w 26 ihii 0"; -game.fenStart = "r2q1bnr/3pp3/n3k1p1/6Pp/3p1B1P/p5R1/1p6/4K1NR w 26 ihii 0"; -game.mycolor = 'w'; -Bd6,b1 then black promotes and win, but UI freezes. - Merge Orda + Empire + Hoppelpoppel + Newzealand getSlideNJumpMoves() into base_rules.js => allow to simplify getPawnMoves in RoyalRace (and some getXMoves in Shatranj) diff --git a/client/src/variants/Avalanche.js b/client/src/variants/Avalanche.js index 40a43938..db024597 100644 --- a/client/src/variants/Avalanche.js +++ b/client/src/variants/Avalanche.js @@ -104,7 +104,7 @@ export class AvalancheRules extends ChessRules { vanish: [ new PiPo({ x: rank, y: file, c: color, p: V.PAWN }) ], - start: { x: 8, y: y }, + start: { x: 8 + (color == 'b' ? 1 : 0), y: y }, end: { x: rank, y: file } }); } diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index ac0a41ec..0be29954 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -1320,7 +1320,9 @@ export default { const trySetVname = setInterval( () => { // this.st.variants might be uninitialized (variant == null) - variant = this.st.variants.find(v => v.id == game.vid); + variant = this.st.variants.find(v => { + return v.id == game.vid || v.name == game.vname + }); if (!!variant) { clearInterval(trySetVname); game.vname = variant.name; diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 224d5d21..db483e1d 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -1095,7 +1095,9 @@ export default { } for (const select of this.newchallenge.V.Options.select || []) { const elt = document.getElementById(select.variable + "_opt"); - chall.options[select.variable] = parseInt(elt.value, 10) || elt.value; + const tryIntVal = parseInt(elt.value, 10); + chall.options[select.variable] = + (isNaN(tryIntVal) ? elt.value : tryIntVal); } error = checkChallenge(chall); if (error) {