From f3da74295bfc114141aa7ce2ea37f16517bf8a40 Mon Sep 17 00:00:00 2001 From: Nicolo Davis Date: Sun, 28 Jan 2018 15:33:03 -0800 Subject: [PATCH] make playerID available in ctx --- src/core/game.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/game.js b/src/core/game.js index f17f7a485..5ea7155e8 100644 --- a/src/core/game.js +++ b/src/core/game.js @@ -84,7 +84,8 @@ function Game({ name, setup, moves, playerView, flow }) { processMove: (G, action, ctx) => { if (moves.hasOwnProperty(action.type)) { const context = { playerID: action.playerID }; - const args = [G, ctx].concat(action.args); + const ctxWithPlayerID = { ...ctx, playerID: action.playerID }; + const args = [G, ctxWithPlayerID].concat(action.args); return moves[action.type].apply(context, args); } return G;