// Basic alphanumeric check for players names
let playerCount = 0;
- for (const p of c.to)
+ for (const pname of c.to)
{
- if (p.name.length > 0)
+ if (pname.length > 0)
{
// TODO: slightly redundant (see data/userCheck.js)
- if (!p.name.match(/^[\w]+$/))
+ if (!pname.match(/^[\w]+$/))
return "Wrong characters in players names";
playerCount++;
}
fen: "",
vid: 0,
nbPlayers: 0,
- // NOTE: id (server DB) and sid (socket ID).
- // Anonymous players just have a socket ID.
- to: [
- {id:0, sid:"", name:""},
- {id:0, sid:"", name:""},
- {id:0, sid:"", name:""}
- ],
- timeControl: "",
+ to: ["", "", ""], //name of challenged players
+ timeControl: "", //"2m+2s" ...etc
},
};
},
if (p.name != "")
{
const pIdx = this.players.findIndex(pl => pl.name == p.name);
+ // TODO: for correspondance play we don't require players to be online
+ // (==> we don't have IDs, and no sid)
+ // NOTE: id (server DB) and sid (socket ID).
+ // Anonymous players just have a socket ID.
if (pIdx === -1)
return alert(p.name + " is not connected");
p.id = this.players[pIdx].id;