summaryrefslogtreecommitdiff
path: root/sw-engine
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-03-29 18:08:49 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-03-29 18:08:49 +0200
commit88e992b0e94d92ac9ac26e8d2d72d818292841ca (patch)
tree244d1e170417b40dc2110b8ca7c14630ac43d871 /sw-engine
parentFix duplicated inconsistent state (diff)
downloadseven-wonders-88e992b0e94d92ac9ac26e8d2d72d818292841ca.tar.gz
seven-wonders-88e992b0e94d92ac9ac26e8d2d72d818292841ca.tar.bz2
seven-wonders-88e992b0e94d92ac9ac26e8d2d72d818292841ca.zip
Rename GameState -> TableState
Diffstat (limited to 'sw-engine')
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt10
-rw-r--r--sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Table.kt4
2 files changed, 7 insertions, 7 deletions
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt
index 931360d6..5a75516c 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/Game.kt
@@ -5,7 +5,7 @@ import org.luxons.sevenwonders.engine.boards.Table
import org.luxons.sevenwonders.engine.cards.Card
import org.luxons.sevenwonders.engine.cards.Decks
import org.luxons.sevenwonders.engine.cards.Hands
-import org.luxons.sevenwonders.engine.converters.toGameState
+import org.luxons.sevenwonders.engine.converters.toTableState
import org.luxons.sevenwonders.engine.converters.toPlayedMove
import org.luxons.sevenwonders.engine.converters.toTableCard
import org.luxons.sevenwonders.engine.data.LAST_AGE
@@ -14,7 +14,7 @@ import org.luxons.sevenwonders.engine.moves.Move
import org.luxons.sevenwonders.engine.moves.resolve
import org.luxons.sevenwonders.engine.score.ScoreBoard
import org.luxons.sevenwonders.model.Action
-import org.luxons.sevenwonders.model.GameState
+import org.luxons.sevenwonders.model.TableState
import org.luxons.sevenwonders.model.PlayerMove
import org.luxons.sevenwonders.model.PlayerTurnInfo
import org.luxons.sevenwonders.model.cards.CardBack
@@ -54,7 +54,7 @@ class Game internal constructor(
return PlayerTurnInfo(
playerIndex = player.index,
- table = table.toGameState(),
+ table = table.toTableState(),
action = action,
hand = hand,
preparedMove = preparedMoves[player.index]?.toPlayedMove(),
@@ -107,7 +107,7 @@ class Game internal constructor(
* had not prepared their moves (unless these players had nothing to do). To avoid this, please check if everyone
* is ready using [allPlayersPreparedTheirMove].
*/
- fun playTurn(): GameState {
+ fun playTurn(): TableState {
makeMoves()
if (endOfAgeReached()) {
executeEndOfAgeEvents()
@@ -118,7 +118,7 @@ class Game internal constructor(
rotateHandsIfRelevant()
startNewTurn()
}
- return table.toGameState()
+ return table.toTableState()
}
private fun makeMoves() {
diff --git a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Table.kt b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Table.kt
index 77843334..290b3dc9 100644
--- a/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Table.kt
+++ b/sw-engine/src/main/kotlin/org/luxons/sevenwonders/engine/converters/Table.kt
@@ -4,9 +4,9 @@ import org.luxons.sevenwonders.engine.SimplePlayer
import org.luxons.sevenwonders.engine.moves.Move
import org.luxons.sevenwonders.model.PlayedMove
import org.luxons.sevenwonders.engine.boards.Table
-import org.luxons.sevenwonders.model.GameState
+import org.luxons.sevenwonders.model.TableState
-internal fun Table.toGameState(): GameState = GameState(
+internal fun Table.toTableState(): TableState = TableState(
boards = boards.mapIndexed { i, b -> b.toApiBoard(SimplePlayer(i, this), lastPlayedMoves.getOrNull(i)) },
currentAge = currentAge,
handRotationDirection = handRotationDirection,
bgstack15