Skip to content

Commit

Permalink
make playerID available in ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
darthfiddler committed Jan 28, 2018
1 parent 0bc9a37 commit f3da742
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f3da742

Please sign in to comment.