this.actionRef = x}
+ spaces={this.props.spaces}
+ player={this.props.player}
+ game={this.props.game}
+ movePlayer={this.props.movePlayer}
+ showNextAction={this.props.nextUIAction}
+ otherPlayersTurn={this.props.player.name !== this.props.game.currentPlayer}
+ screen={this.state.screen}
+ showScreen={screen => this.showScreen(screen)}
+ ui={this.props.ui} />);
// faExchangeAlt -> trade icon, hidden for now
return (
@@ -1705,17 +1734,7 @@ class BoardApp extends React.Component {
game={this.props.game} showScreen={this.showScreen} />
-
this.actionRef = x}
- spaces={this.props.spaces}
- player={this.props.player}
- game={this.props.game}
- movePlayer={this.props.movePlayer}
- showNextAction={this.props.nextUIAction}
- otherPlayersTurn={this.props.player.name !== this.props.game.currentPlayer}
- screen={this.state.screen}
- showScreen={screen => this.showScreen(screen)}
- ui={this.props.ui} />
+ {actionComponent}
@@ -1757,17 +1776,7 @@ class BoardApp extends React.Component {
-
this.actionRefExtra = x}
- spaces={this.props.spaces}
- player={this.props.player}
- game={this.props.game}
- movePlayer={this.props.movePlayer}
- showNextAction={this.props.nextUIAction}
- otherPlayersTurn={this.props.player.name !== this.props.game.currentPlayer}
- screen={this.state.screen}
- showScreen={screen => this.showScreen(screen)}
- ui={this.props.ui} />
+ {actionComponent}
diff --git a/src/components/farm/interface.js b/src/components/farm/interface.js
index f3c904c..c7b29ad 100644
--- a/src/components/farm/interface.js
+++ b/src/components/farm/interface.js
@@ -108,15 +108,6 @@ function handleMessage(evt) {
if (data.event === 'end-of-game') {
store.dispatch(alert(ALERTS.endOfGame, data.results, 'endOfGame' + data.game.turn));
}
- if (data.event === 'action' && data.action === false) {
- const playerSpaces = store.getState().farm.ui.playerSpaces;
- data.game.otherPlayers.map(x => x.player).concat([data.player]).forEach(player => {
- if (player.space !== playerSpaces[player.color]) {
- store.dispatch(movePlayer(player.space, playerSpaces[player.color],
- player.color));
- }
- });
- }
});
};
@@ -133,6 +124,14 @@ function roll() {
}
function endTurn() {
+ const farmState = store.getState().farm;
+ const playerSpaces = farmState.ui.playerSpaces;
+ farmState.game.otherPlayers.map(x => x.player).concat([farmState.player]).forEach(player => {
+ if (player.space !== playerSpaces[player.color]) {
+ store.dispatch(movePlayer(player.space, playerSpaces[player.color],
+ player.color));
+ }
+ });
store.dispatch(gameState(GAME_STATES.turnEnded));
sendCommand({ type: 'turn-ended' });
}