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

@ -191,7 +191,7 @@ namespace Server.Guilds
public void TurnToMember(Guild g)
{
if (g.Alliance != this || !m_PendingMembers.Contains(g) || m_Members.Contains(g))
if (g.Alliance != this || m_Members.Contains(g) || !m_PendingMembers.Remove(g))
{
return;
}
@ -199,21 +199,16 @@ namespace Server.Guilds
g.GuildMessage(1070760, Name); // Your Guild has joined the ~1_ALLIANCENAME~ Alliance.
AllianceMessage(1070761, g.Name); // A new Guild has joined your Alliance: ~1_GUILDNAME~
m_PendingMembers.Remove(g);
m_Members.Add(g);
g.Alliance.InvalidateMemberProperties();
}
public void RemoveGuild(Guild g)
{
if (m_PendingMembers.Contains(g))
{
m_PendingMembers.Remove(g);
}
m_PendingMembers.Remove(g);
if (m_Members.Contains(g)) // Sanity, just incase someone with a custom script adds a character to BOTH arrays
if (m_Members.Remove(g)) // Sanity, just incase someone with a custom script adds a character to BOTH arrays
{
m_Members.Remove(g);
g.InvalidateMemberProperties();
g.GuildMessage(1070763, Name); // Your Guild has been removed from the ~1_ALLIANCENAME~ Alliance.