Skip to content

Commit 0e7ba10

Browse files
Rename sendBotListUpdateToObservers to sendBotListUpdateToObserversAndControllers and update relevant calls for better clarity.
1 parent 784897d commit 0e7ba10

File tree

1 file changed

+4
-3
lines changed
  • server/src/main/kotlin/dev/robocode/tankroyale/server/core

1 file changed

+4
-3
lines changed

server/src/main/kotlin/dev/robocode/tankroyale/server/core/GameServer.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,8 @@ class GameServer(
650650
connectionHandler.broadcast(participants, json) // note: it is only participants, not all bots
651651
}
652652

653-
private fun sendBotListUpdateToObservers() {
653+
// Note: Despite the name, this update is intended for both observers and controllers
654+
private fun sendBotListUpdateToObserversAndControllers() {
654655
// Send a clone of the message to prevent race conditions if the message is updated during broadcast
655656
broadcastToObserverAndControllers(cloneBotListUpdate(botListUpdateMessage))
656657
}
@@ -669,7 +670,7 @@ class GameServer(
669670

670671
internal fun handleBotJoined() {
671672
updateBotListUpdateMessage()
672-
sendBotListUpdateToObservers()
673+
sendBotListUpdateToObserversAndControllers()
673674
}
674675

675676
internal fun handleBotLeft(conn: WebSocket) {
@@ -689,7 +690,7 @@ class GameServer(
689690
}
690691

691692
updateBotListUpdateMessage()
692-
sendBotListUpdateToObservers()
693+
sendBotListUpdateToObserversAndControllers()
693694
}
694695

695696
internal fun handleBotReady(conn: WebSocket) {

0 commit comments

Comments
 (0)