diff --git a/app/controllers/Round.scala b/app/controllers/Round.scala index aa5bdd35e6..0082251b41 100644 --- a/app/controllers/Round.scala +++ b/app/controllers/Round.scala @@ -41,6 +41,7 @@ object Round extends LilaController with TheftPrevention { def player(fullId: String) = Open { implicit ctx ⇒ OptionFuResult(GameRepo pov fullId) { pov ⇒ + if (pov.game.playableByAi) env.roundMap ! Tell(pov.game.id, AiPlay(_ ⇒ ())) pov.game.started.fold( PreventTheft(pov) { (pov.game.hasChat optionFu { diff --git a/modules/game/src/main/Game.scala b/modules/game/src/main/Game.scala index 893bc9a504..2a114ebd1d 100644 --- a/modules/game/src/main/Game.scala +++ b/modules/game/src/main/Game.scala @@ -196,6 +196,8 @@ case class Game( def playableBy(c: Color): Boolean = playableBy(player(c)) + def playableByAi: Boolean = playable && player.isAi + def continuable = status != Status.Mate && status != Status.Stalemate def fenString = Forsyth >> toChess diff --git a/modules/round/src/main/Player.scala b/modules/round/src/main/Player.scala index e10879be69..61498262aa 100644 --- a/modules/round/src/main/Player.scala +++ b/modules/round/src/main/Player.scala @@ -32,8 +32,7 @@ private[round] final class Player( notifyProgress(progress) >> progress.game.finished.fold( moveFinish(progress.game, color) map { progress.events ::: _ }, { - if (progress.game.player.isAi && progress.game.playable) - roundMap ! Tell(game.id, AiPlay(onFailure)) + if (progress.game.playableByAi) roundMap ! Tell(game.id, AiPlay(onFailure)) fuccess(progress.events) }) })