Fixed MaxLimit not being properly ignored when set to 0 (#41852)

* Fixed the issue

* Remove stray line
This commit is contained in:
Atakku 2026-05-18 23:16:17 +02:00 • committed by GitHub
parent 679744311e
commit b8519626ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -124,7 +124,7 @@ public sealed partial class RoleLoadout : IEquatable<RoleLoadout>
continue;
}
var loadouts = groupLoadouts[..Math.Min(groupLoadouts.Count, groupProto.MaxLimit)];
var loadouts = groupProto.MaxLimit > 0 ? groupLoadouts[..Math.Min(groupLoadouts.Count, groupProto.MaxLimit)] : groupLoadouts;
// Validate first
for (var i = loadouts.Count - 1; i >= 0; i--)
@ -297,7 +297,8 @@ public sealed partial class RoleLoadout : IEquatable<RoleLoadout>
var groupLoadouts = SelectedLoadouts[selectedGroup];
// Need to unselect existing ones if we're at or above limit
var limit = Math.Max(0, groupLoadouts.Count + 1 - protoManager.Index(selectedGroup).MaxLimit);
var groupProto = protoManager.Index(selectedGroup);
var limit = groupProto.MaxLimit > 0 ? Math.Max(0, groupLoadouts.Count + 1 - protoManager.Index(selectedGroup).MaxLimit) : 0;
for (var i = 0; i < groupLoadouts.Count; i++)
{