From: Carl Worth Date: Thu, 25 Jun 2020 01:28:34 +0000 (-0700) Subject: game: Fix to actually drop connections that get closed X-Git-Url: https://git.cworth.org/git?p=lmno-server;a=commitdiff_plain;h=13553d82c4746db09ce801421f0e9a5efcc300bb game: Fix to actually drop connections that get closed The bug here is that filter() returns a new array, so I have to assign the return value to the original reference for this code to have any effect. --- diff --git a/game.js b/game.js index 5a49b6b..4649b56 100644 --- a/game.js +++ b/game.js @@ -23,7 +23,7 @@ class Player { /* Returns the number of remaining connections after this one is removed. */ remove_connection(connection) { - this.connections.filter(c => c !== connection); + this.connections = this.connections.filter(c => c !== connection); return this.connections.length; }