refactor: merge land command Before/After into shared phase-aware dispatch
This commit is contained in:
@@ -68,35 +68,35 @@ public class ClaimLinkRegistry
|
||||
Save();
|
||||
}
|
||||
|
||||
public bool IsClaimLinked(string ownerPlayerUid, int localIndex) =>
|
||||
FindLinkContaining(ownerPlayerUid, localIndex) != null;
|
||||
public bool IsClaimLinked(string ownerPlayerUid, int claimIndex) =>
|
||||
FindLinkContaining(ownerPlayerUid, claimIndex) != null;
|
||||
|
||||
public ClaimLink? FindLinkContaining(string ownerPlayerUid, int localIndex)
|
||||
public ClaimLink? FindLinkContaining(string ownerPlayerUid, int claimIndex)
|
||||
{
|
||||
if (!byPlayer.TryGetValue(ownerPlayerUid, out Dictionary<int, List<int>>? perGroup))
|
||||
return null;
|
||||
|
||||
foreach (KeyValuePair<int, List<int>> entry in perGroup)
|
||||
if (entry.Value.Contains(localIndex))
|
||||
if (entry.Value.Contains(claimIndex))
|
||||
return Get(entry.Key);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void AddEntry(string ownerPlayerUid, int groupId, int localClaimIndex)
|
||||
public void AddEntry(string ownerPlayerUid, int groupId, int claimIndex)
|
||||
{
|
||||
GetOrCreateIndices(ownerPlayerUid, groupId).Add(localClaimIndex);
|
||||
GetOrCreateIndices(ownerPlayerUid, groupId).Add(claimIndex);
|
||||
Save();
|
||||
}
|
||||
|
||||
public void RemoveEntry(string ownerPlayerUid, int groupId, int localClaimIndex)
|
||||
public void RemoveEntry(string ownerPlayerUid, int groupId, int claimIndex)
|
||||
{
|
||||
if (
|
||||
byPlayer.TryGetValue(ownerPlayerUid, out Dictionary<int, List<int>>? perGroup)
|
||||
&& perGroup.TryGetValue(groupId, out List<int>? indices)
|
||||
)
|
||||
{
|
||||
indices.Remove(localClaimIndex);
|
||||
indices.Remove(claimIndex);
|
||||
if (indices.Count == 0)
|
||||
perGroup.Remove(groupId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user