refactor: unlink no longer needs a groupname arg
A claim can only belong to one claim link at a time, so it resolves via the new Registry.FindLinkContaining(playerUid, claimIndex).
This commit is contained in:
@@ -44,14 +44,16 @@ public class ClaimLinkRegistry
|
||||
Save();
|
||||
}
|
||||
|
||||
public bool IsClaimLinked(string ownerPlayerUid, int localIndex)
|
||||
public bool IsClaimLinked(string ownerPlayerUid, int localIndex) => FindLinkContaining(ownerPlayerUid, localIndex) != null;
|
||||
|
||||
public ClaimLink? FindLinkContaining(string ownerPlayerUid, int localIndex)
|
||||
{
|
||||
foreach (ClaimLink link in byGroupId.Values)
|
||||
foreach (ClaimLinkMember member in link.Members)
|
||||
if (member.OwnerPlayerUid == ownerPlayerUid && member.LocalClaimIndices.Contains(localIndex))
|
||||
return true;
|
||||
return link;
|
||||
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
|
||||
Reference in New Issue
Block a user