Conversation
# Conflicts: # game-server/src/main/kotlin/ru/ifmo/sd/httpapi/routes/GameRoutes.kt # game-server/src/main/kotlin/ru/ifmo/sd/world/configuration/GameConfiguration.kt
…ayer-client # Conflicts: # game-client/src/main/kotlin/ru/ifmo/sd/stuff/ServerAPI.kt
|
Изначально запускается мультиплеер. Для этого нужно ввести свое уникальное имя для идентификации (нормальной проверки корректности имени пока нет)
|
Странно, что сразу коннектит, а не предлагает выбрать, но ок
Ага, еще карта лагает и мобы чего-то совсем не двигаются( |
| // val hpLabel = JLabel("HP: ") | ||
| // infoPanel.add(hpLabel, BorderLayout.WEST) |
There was a problem hiding this comment.
Опять какие-то закомментированные куски
| } | ||
| println("Trying to start local server at port=${port}") | ||
| println(System.getProperty("user.dir")) | ||
| val cmd = "../game-server/build/install/game-server/bin/game-server" // TODO call .bat for windows |
There was a problem hiding this comment.
Это вот весьма странный способ. На win не будет работать, ага
| println(e.localizedMessage) | ||
| started = false | ||
| } | ||
| if (started) break |
There was a problem hiding this comment.
Хотя бы
while (!started) { ...а лучше вообще
while (true) {
try {
joinLocal()
break
} catch (e: Exception) {
println(e.localizedMessage)
}
}До break просто не дойдем, если исключение произошло
| } | ||
| } | ||
|
|
||
| internal fun resetMapSize() { |
There was a problem hiding this comment.
А зачем они internal?
| private fun isAvailable(portNr: Int): Boolean { | ||
| var portFree: Boolean | ||
| try { | ||
| ServerSocket(portNr).use { portFree = true } |
There was a problem hiding this comment.
Тут тоже return прямо внутри try подошел бы лучше, кажется
|
|
||
| private fun placeEnemies(maze: Maze, healths: UnitsHealthStorage, npc: NpcEventProvider) { | ||
| val countOfEnemies = (maze.size() * gameDifficulty).toInt() | ||
| freePos.forEach { maze.freePos.add(it) } |
There was a problem hiding this comment.
maze.freePos.addAll(freePos)forEach в идеале не должен нигде изменений делать
| val npcMove = gameLevel.npcEventProvider.move(playerPos, maze) | ||
| npcMove.forEach { maze[it.position] = it.newMazeObj } | ||
| val newPlayerPos = | ||
| if (maze[playerPos] != null) playerPos |
There was a problem hiding this comment.
Лучше скобоки ставить, а то совсем нечитаемая елка получается
No description provided.