Skip to content

Commit

Permalink
fix(ui): fix display of selectable pieces depending on current gamestate
Browse files Browse the repository at this point in the history
  • Loading branch information
SKoschnicke committed Oct 23, 2020
1 parent 9873685 commit 4d17c88
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/main/kotlin/sc/gui/controller/GameController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class GameController : Controller() {
subscribe<HumanMoveRequest> { event ->
logger.debug("Human move request")
isHumanTurnProperty().set(true)
canSkipProperty().set(!gameEnded && isHumanTurn && !GameRuleLogic.isFirstMove(gameState))
canSkipProperty().set(!gameEnded && isHumanTurn && !GameRuleLogic.isFirstMove(event.gameState))
boardController.calculateIsPlaceableBoard(event.gameState.board, event.gameState.currentColor)

when (event.gameState.currentColor) {
Expand All @@ -223,12 +223,7 @@ class GameController : Controller() {
Color.GREEN -> validGreenPiecesProperty()
Color.YELLOW -> validYellowPiecesProperty()
}.set(event.gameState.undeployedPieceShapes(event.gameState.currentColor).filter { shape ->
try {
GameRuleLogic.validateShape(gameState, shape)
true
} catch(ignored: InvalidMoveException) {
false
}
GameRuleLogic.validateShape(event.gameState, shape) == null
} as ArrayList<PieceShape>?)
}
subscribe<GameOverEvent> {
Expand Down

0 comments on commit 4d17c88

Please sign in to comment.