Fix RoleLoadout equality (#28737)
* Fix RoleLoadout equality Knew it was janky but thought SequenceEqual was better than it is so we just do it manually. * Also implement this
This commit is contained in:
@@ -295,7 +295,25 @@ public sealed partial class RoleLoadout : IEquatable<RoleLoadout>
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
return Role.Equals(other.Role) && SelectedLoadouts.SequenceEqual(other.SelectedLoadouts) && Points == other.Points;
|
||||
|
||||
if (!Role.Equals(other.Role) ||
|
||||
SelectedLoadouts.Count != other.SelectedLoadouts.Count ||
|
||||
Points != other.Points)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Tried using SequenceEqual but it stinky so.
|
||||
foreach (var (key, value) in SelectedLoadouts)
|
||||
{
|
||||
if (!other.SelectedLoadouts.TryGetValue(key, out var otherValue) ||
|
||||
!otherValue.SequenceEqual(value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
|
||||
Reference in New Issue
Block a user