// * - prepare and start new game (if challenge is full after acceptation)
// * --> include challenge ID (so that opponents can delete the challenge too)
clickChallenge: function(c) {
// * - prepare and start new game (if challenge is full after acceptation)
// * --> include challenge ID (so that opponents can delete the challenge too)
clickChallenge: function(c) {
- case "live":
- if (!!c.accepted)
- {
- this.st.conn.send(JSON.stringify({code: "withdrawchallenge",
- cid: c.id, target: c.from.sid}));
-
- break;
- case "corr":
+ this.st.conn.send(JSON.stringify({code: "withdrawchallenge",
+ cid: c.id, target: c.from.sid}));
+ if (c.type == "corr")
+ {
this.sendSomethingTo(c.to, "deletechallenge", {cid:c.id});
ArrayFun.remove(this.challenges, ch => ch.id == c.id);
this.sendSomethingTo(c.to, "deletechallenge", {cid:c.id});
ArrayFun.remove(this.challenges, ch => ch.id == c.id);
// TODO: if special FEN, show diagram after loading variant
c.accepted = confirm("Accept challenge?");
}
// TODO: if special FEN, show diagram after loading variant
c.accepted = confirm("Accept challenge?");
}
// Just assign colors and pass the message
const vname = this.getVname(c.vid);
const vModule = await import("@/variants/" + vname + ".js");
// Just assign colors and pass the message
const vname = this.getVname(c.vid);
const vModule = await import("@/variants/" + vname + ".js");
fen: c.fen || V.GenRandInitFen(),
// Shuffle players order (white then black then other colors).
// Players' names may be required if game start when a player is offline
fen: c.fen || V.GenRandInitFen(),
// Shuffle players order (white then black then other colors).
// Players' names may be required if game start when a player is offline