From: Raphaƫl Jakse Date: Wed, 15 Apr 2020 22:28:15 +0000 (+0200) Subject: Remove information about the bag being suffled X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=422f96e61d43fb1b89ab25b74844cccb4af7a7fa;p=trivabble.git Remove information about the bag being suffled --- diff --git a/trivabble-server.js b/trivabble-server.js index f88b4bf..680df2d 100644 --- a/trivabble-server.js +++ b/trivabble-server.js @@ -272,29 +272,17 @@ Game.prototype.toJSON = function () { bag: this.bag, racks: this.racks, scores: this.scores, - lastUpdated: this.lastUpdated.toISOString(), - bagShuffled: true // Will be gone soon, needed for compatibility with saved games + lastUpdated: this.lastUpdated.toISOString() }; }; Game.fromJSON = function (obj) { - // WARNING: modifies the passed parameter because of the suffling. - // This is harmless here, and temporary anyway. - // Variable bagShuffled is soon to be gone. - const game = new Game(); game.board = obj.board || newBoard(); game.bag = obj.bag || frBag.slice(); game.racks = obj.racks || {}; game.scores = obj.scores || {}; game.lastUpdated = obj.lastUpdated ? new Date(obj.lastUpdated) : new Date(); - - // To delete soon - if (!obj.bagShuffled) { - game.bag = game.bag.filter((tile) => tile !== ""); - shuffleInPlace(game.bag); - } - return game; };