Merge API changes.

This commit is contained in:
Ottermandias 2023-03-25 12:34:47 +01:00
parent d32e777426
commit fb2fe05409
2 changed files with 14 additions and 8 deletions

View file

@ -848,10 +848,16 @@ public class PenumbraApi : IDisposable, IPenumbraApi
if (!_tempCollections.CollectionByName(collectionName, out var collection))
return PenumbraApiEc.CollectionMissing;
if (!forceAssignment
&& (_tempCollections.Collections.Individuals.ContainsKey(identifier)
|| _collectionManager.Individuals.Individuals.ContainsKey(identifier)))
if (forceAssignment)
{
if (_tempCollections.Collections.Individuals.ContainsKey(identifier) && !_tempCollections.Collections.Delete(identifier))
return PenumbraApiEc.AssignmentDeletionFailed;
}
else if (_tempCollections.Collections.Individuals.ContainsKey(identifier)
|| _collectionManager.Individuals.Individuals.ContainsKey(identifier))
{
return PenumbraApiEc.CharacterCollectionExists;
}
var group = _tempCollections.Collections.GetGroup(identifier);
return _tempCollections.AddIdentifier(collection, group)

View file

@ -67,11 +67,11 @@ public class TempCollectionManager : IDisposable
collection.ClearCache();
for (var i = 0; i < Collections.Count; ++i)
{
if (Collections[i].Collection == collection)
{
_communicator.CollectionChange.Invoke(CollectionType.Temporary, collection, null, Collections[i].DisplayName);
Collections.Delete(i);
}
if (Collections[i].Collection != collection)
continue;
_communicator.CollectionChange.Invoke(CollectionType.Temporary, collection, null, Collections[i].DisplayName);
Collections.Delete(i--);
}
return true;