diff options
Diffstat (limited to 'src/main/scala/Client')
-rw-r--r-- | src/main/scala/Client/Client.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/scala/Client/Client.scala b/src/main/scala/Client/Client.scala index e9d3074..7b0f8b2 100644 --- a/src/main/scala/Client/Client.scala +++ b/src/main/scala/Client/Client.scala @@ -17,7 +17,7 @@ import java.lang.System.currentTimeMillis /** A helper enum for `Client` to keep track of communications with the server */ enum ServerLineState: - case WaitingForGameStart, + case WaitingForTimeLimit, ActionDescription, TurnIndicator, AreaDescription, @@ -63,7 +63,7 @@ class Client(socket: Socket): private val serverLineParser = ReceivedLineParser() private val stdinReader = StdinLineReader() - private var serverLineState = ServerLineState.WaitingForGameStart + private var serverLineState = ServerLineState.WaitingForTimeLimit /** Variables about the status of the current turn for the client */ private var canAct = false @@ -140,12 +140,13 @@ class Client(socket: Socket): serverLineState match - case ServerLineState.WaitingForGameStart => + case ServerLineState.WaitingForTimeLimit => val time = line.toLongOption time match case Some(t) => this.timeLimit = t case None => print("Invalid time limit, oh no!!!") - this.serverLineState = ServerLineState.ActionDescription + this.serverLineState = ServerLineState.TurnIndicator + this.lastTurnStart = currentTimeMillis / 1000 case ServerLineState.ActionDescription => if line.head == ACTION_BLOCKING_INDICATOR then |