From 0022ba64924ac40a9c9460906768053fe20be99b Mon Sep 17 00:00:00 2001 From: marco_a <4279489-marco_a@users.noreply.gitlab.com> Date: Sun, 9 Jun 2024 23:23:01 +0200 Subject: [PATCH] CRASHFIX: matchmaking was broken when two teams were already in a queue and a solo player joined --- src/api/in_queue.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/api/in_queue.lua b/src/api/in_queue.lua index e6882bc..3a4c68c 100644 --- a/src/api/in_queue.lua +++ b/src/api/in_queue.lua @@ -378,13 +378,21 @@ function arena_lib.queue_to_arena(mod, arena) -- sennò.. else - local all_max_curr_amount = false + -- metto vero di base in caso già tutte le squadre disponibili abbiano lo + -- stesso ammontare di membri. Smentisco eventualmente nel for sottostante + local all_max_curr_amount = true + + for _, amount in pairs(arena.players_amount_per_team) do + if amount < max_curr_amount then + all_max_curr_amount = false + break + end + end for _, pl_data in pairs(arena.players) do if not pl_data.teamID then -- prima ripartisco fino a raggiungere max_curr_amount su tutte le squadre.. if not all_max_curr_amount then - for teamID, amount in pairs(arena.players_amount_per_team) do if amount < max_curr_amount then pl_data.teamID = teamID