fix: Eliminates double lookup with Contains->Remove (#2539)

This commit is contained in:
Kamron Batman 2026-07-19 09:26:27 -07:00 committed by GitHub
parent e12cc5dd83
commit 8d88ef70fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 25 additions and 80 deletions

View file

@ -1865,17 +1865,14 @@ namespace Server.Gumps
{
var acct = (Account)m_List[v];
if (info.IsSwitched(v))
{
if (!rads.Contains(acct))
{
rads.Add(acct);
}
}
else if (rads.Contains(acct))
if (!info.IsSwitched(v))
{
rads.Remove(acct);
}
else if (!rads.Contains(acct))
{
rads.Add(acct);
}
}
}
}

View file

@ -226,13 +226,10 @@ public class Gump : BaseGump
public void Remove(GumpEntry g)
{
if (g == null || !Entries.Contains(g))
if (g != null && Entries.Remove(g))
{
return;
g.Parent = null;
}
Entries.Remove(g);
g.Parent = null;
}
public int Intern(string value)