From b9108dd5f848f13db157cdbe04a2b403e2d8ee7d Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Tue, 23 Feb 2021 18:31:20 +0100 Subject: Use proper sealed class for TurnActions --- .../org/luxons/sevenwonders/server/controllers/AutoGameController.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sw-server/src/main') diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/AutoGameController.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/AutoGameController.kt index a4aceb96..b6d66e4b 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/AutoGameController.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/controllers/AutoGameController.kt @@ -5,6 +5,7 @@ import kotlinx.coroutines.withTimeout import org.luxons.sevenwonders.bot.connectBot import org.luxons.sevenwonders.bot.connectBots import org.luxons.sevenwonders.client.SevenWondersClient +import org.luxons.sevenwonders.model.TurnAction import org.luxons.sevenwonders.model.api.AutoGameAction import org.luxons.sevenwonders.model.api.AutoGameResult import org.slf4j.LoggerFactory @@ -48,7 +49,8 @@ class AutoGameController( lastTurn } - val scoreBoard = lastTurn.scoreBoard ?: error("Last turn info doesn't have scoreboard") + val turnAction = lastTurn.action as? TurnAction.WatchScore ?: error("Last turn action should be to watch the score") + val scoreBoard = turnAction.scoreBoard return AutoGameResult(scoreBoard, lastTurn.table) } -- cgit