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

@ -350,28 +350,8 @@ public abstract class Town : IComparable<Town>
return true;
}
public bool UnregisterGuard(BaseFactionGuard guard)
{
if (guard == null)
{
return false;
}
var guardList = FindGuardList(guard.GetType());
if (guardList == null)
{
return false;
}
if (!guardList.Guards.Contains(guard))
{
return false;
}
guardList.Guards.Remove(guard);
return true;
}
public bool UnregisterGuard(BaseFactionGuard guard) =>
guard != null && FindGuardList(guard.GetType())?.Guards.Remove(guard) == true;
public bool RegisterVendor(BaseFactionVendor vendor)
{