Skip to content

Commit 097a513

Browse files
committed
Quincunx: Fix empty hand rendering issue
1 parent c426e85 commit 097a513

File tree

4 files changed

+26
-25
lines changed

4 files changed

+26
-25
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
},
6464
"dependencies": {
6565
"@abstractplay/recranks": "latest",
66-
"@abstractplay/renderer": "^1.0.0-ci-15542788686.0",
66+
"@abstractplay/renderer": "latest",
6767
"@turf/boolean-contains": "^6.5.0",
6868
"@turf/boolean-intersects": "^6.5.0",
6969
"@turf/boolean-point-in-polygon": "^6.5.0",

src/games/biscuit.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,6 @@ export class BiscuitGame extends GameBase {
12111211
return resolved;
12121212
}
12131213

1214-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
12151214
public serialize(opts?: {strip?: boolean, player?: number}): string {
12161215
const json = JSON.stringify(this.state(opts), replacer);
12171216
const compressed = pako.gzip(json);

src/games/quincunx.ts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -841,25 +841,27 @@ export class QuincunxGame extends GameBase {
841841
const areas: AreaPieces[] = [];
842842
for (let p = 1; p <= this.numplayers; p++) {
843843
const hand = [...this.hands[p-1]];
844-
if (!hand.includes("")) {
845-
const sorted = hand.map(uid => Card.deserialize(uid)!).sort(cardSortAsc).map(c => c.uid).sort((a,b) => {
846-
if (this.masked.includes(a) && this.masked.includes(b)) {
847-
return 0;
848-
} else if (this.masked.includes(a)) {
849-
return 1
850-
} else if (this.masked.includes(b)) {
851-
return -1;
852-
} else {
853-
return 0;
854-
}
855-
}).map(c => this.masked.includes(c) ? "cUNKNOWN" : ("c" + c));
856-
areas.push({
857-
type: "pieces",
858-
pieces: sorted as [string, ...string[]],
859-
label: i18next.t("apgames:validation.jacynth.LABEL_STASH", {playerNum: p}) || `P${p} Hand`,
860-
spacing: 0.5,
861-
width: width < 6 ? 6 : undefined,
862-
});
844+
if (hand.length > 0) {
845+
if (!hand.includes("")) {
846+
const sorted = hand.map(uid => Card.deserialize(uid)!).sort(cardSortAsc).map(c => c.uid).sort((a,b) => {
847+
if (this.masked.includes(a) && this.masked.includes(b)) {
848+
return 0;
849+
} else if (this.masked.includes(a)) {
850+
return 1
851+
} else if (this.masked.includes(b)) {
852+
return -1;
853+
} else {
854+
return 0;
855+
}
856+
}).map(c => this.masked.includes(c) ? "cUNKNOWN" : ("c" + c));
857+
areas.push({
858+
type: "pieces",
859+
pieces: sorted as [string, ...string[]],
860+
label: i18next.t("apgames:validation.jacynth.LABEL_STASH", {playerNum: p}) || `P${p} Hand`,
861+
spacing: 0.5,
862+
width: width < 6 ? 6 : undefined,
863+
});
864+
}
863865
}
864866
}
865867
// create an area for all invisible cards (if there are any cards left)

0 commit comments

Comments
 (0)