aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/menu/lobby.gd8
1 files changed, 3 insertions, 5 deletions
diff --git a/client/menu/lobby.gd b/client/menu/lobby.gd
index 44afe9cf..7d1e3af7 100644
--- a/client/menu/lobby.gd
+++ b/client/menu/lobby.gd
@@ -17,6 +17,7 @@
extends Control
class_name Lobby
+const MAX_BOT_COUNT_PER_TYPE: int = 16
const PLAYER = preload("res://menu/lobby/player.tscn")
var map_count
@@ -116,14 +117,11 @@ func select_map(i: int):
map_list_container.get_child(i).grab_focus()
func increase_bot_count(algo_id: String):
- bot_counts[algo_id] = bot_counts[algo_id] + 1
+ bot_counts[algo_id] = clampi(bot_counts[algo_id] + 1, 0, MAX_BOT_COUNT_PER_TYPE)
update_bot_reset_text(algo_id)
func decrease_bot_count(algo_id: String):
- var new_count = bot_counts[algo_id] - 1
- if new_count < 0:
- return
- bot_counts[algo_id] = new_count
+ bot_counts[algo_id] = clampi(bot_counts[algo_id] - 1, 0, MAX_BOT_COUNT_PER_TYPE)
update_bot_reset_text(algo_id)
func reset_bot_count(algo_id: String):