aboutsummaryrefslogtreecommitdiff
path: root/src/scalevalapokalypsi/constants/constants.scala
blob: 268e5b2b9f074aafa63f7a726b52b1f1976e0c64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

package scalevalapokalypsi.constants

val MAX_MSG_SIZE = 1024 // bytes
val CRLF: Vector[Byte] = Vector(13.toByte, 10.toByte)
val POLL_INTERVAL = 100 // millisec.
val GAME_VERSION = "0.2.0"
val TURN_INDICATOR = ">"
val SING_INDICATOR = "~"
val GAME_END_INDICATOR = "!"
val ACTION_BLOCKING_INDICATOR='.'
val ACTION_NONBLOCKING_INDICATOR='+'
val INITIAL_CONN_TIMEOUT = 5000 // millisec.
val DEFAULT_PORT: Int = 2267
val DEFAULT_TURN_TIME_LIMIT = 30
val DEFAULT_SERVER = "dev.cron4.fi"

val LIST_SEPARATOR=";"

val BYTE_ALLOWED =
	(n: Byte) => !(n <= 31 || (n >= 127 && n <= 159))

val FORBIDDEN_CHARACTERS = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u0009\u000B\u000C\u000D\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\u007F\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F"

val PROTOCOL_VERSION_GOOD = "1"
val PROTOCOL_VERSION_BAD = "0"
// assert(PROTOCOL_VERSION_BAD.length <= PROTOCOL_VERSION_GOOD.length)

enum ServerProtocolState:
	case WaitingForVersion, WaitingForClientName, WaitingForGameStart, InGame