- // Also remove all challenges sent by this player:
- ArrayFun.remove(this.challenges, c => c.from.sid == data.from);
- // And all live games where he plays and no other opponent is online
- ArrayFun.remove(this.games, g =>
- g.type == "live" && (g.players.every(p => p.sid == data.from
- || !this.people[p.sid])), "all");
+ if (data.code == "disconnect")
+ {
+ // Also remove all challenges sent by this player:
+ ArrayFun.remove(this.challenges, c => c.from.sid == data.from);
+ }
+ else
+ {
+ // And all live games where he plays and no other opponent is online
+ ArrayFun.remove(this.games, g =>
+ g.type == "live" && (g.players.every(p => p.sid == data.from
+ || !this.people[p.sid])), "all");
+ }