{
// New game request has been cancelled on disconnect
this.seek = true;
- this.newGame("human");
+ this.newGame("human", "reconnect");
}
};
const socketMessageListener = msg => {
this.score = "*";
if (mode=="human" && !oppId)
{
+ const storageVariant = localStorage.getItem("variant");
+ if (!!storageVariant && storageVariant !== variant)
+ {
+ // TODO: find a better way to ensure this. Newgame system is currently a mess.
+ alert("Finish your " + storageVariant + " game first!");
+ return;
+ }
// Send game request and wait..
this.clearStorage(); //in case of
try {
} catch (INVALID_STATE_ERR) {
return; //nothing achieved
}
- let modalBox = document.getElementById("modal-control2");
- modalBox.checked = true;
- setTimeout(() => { modalBox.checked = false; }, 2000);
+ if (!fenInit || fenInit!="reconnect") //TODO: bad HACK...
+ {
+ let modalBox = document.getElementById("modal-control2");
+ modalBox.checked = true;
+ setTimeout(() => { modalBox.checked = false; }, 2000);
+ }
return;
}
this.vr = new VariantRules(fen, moves || []);
this.mode = mode;
+ this.incheck = []; //in case of
this.fenStart = continuation
? localStorage.getItem("fenStart")
: fen.split(" ")[0]; //Only the position matters