- localStorage.setItem("myid", this.myid);
- localStorage.setItem("variant", variant);
- localStorage.setItem("mycolor", this.mycolor);
- localStorage.setItem("oppid", this.oppid);
- localStorage.setItem("fenStart", this.fenStart);
- localStorage.setItem("moves", JSON.stringify(this.vr.moves));
- localStorage.setItem("fen", this.vr.getFen());
+ if (this.mode=="human")
+ {
+ localStorage.setItem("myid", this.myid);
+ localStorage.setItem("oppid", this.oppid);
+ }
+ // 'prefix' = "comp-" to resume games vs. computer
+ const prefix = (this.mode=="computer" ? "comp-" : "");
+ localStorage.setItem(prefix+"variant", variant);
+ localStorage.setItem(prefix+"mycolor", this.mycolor);
+ localStorage.setItem(prefix+"fenStart", this.fenStart);
+ localStorage.setItem(prefix+"moves", JSON.stringify(this.vr.moves));
+ localStorage.setItem(prefix+"fen", this.vr.getFen());