mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
fix: fix an issue where commands would collapse to the point of the last deleted command instead of the position in queue where the new command was going
This commit is contained in:
parent
5900f5974b
commit
b9f5349055
1 changed files with 1 additions and 21 deletions
|
|
@ -134,8 +134,6 @@ namespace ICD.Common.Utils.Collections
|
|||
if (remove == null)
|
||||
throw new ArgumentNullException("remove");
|
||||
|
||||
bool inserted = false;
|
||||
|
||||
foreach (KeyValuePair<int, List<T>> kvp in m_PriorityToQueue.ToArray())
|
||||
{
|
||||
int[] removeIndices =
|
||||
|
|
@ -144,35 +142,17 @@ namespace ICD.Common.Utils.Collections
|
|||
.Reverse()
|
||||
.ToArray();
|
||||
|
||||
if (removeIndices.Length == 0)
|
||||
continue;
|
||||
|
||||
foreach (int removeIndex in removeIndices)
|
||||
{
|
||||
kvp.Value.RemoveAt(removeIndex);
|
||||
m_Count--;
|
||||
}
|
||||
|
||||
if (!inserted)
|
||||
{
|
||||
int insertIndex = removeIndices[0];
|
||||
|
||||
if (insertIndex >= kvp.Value.Count)
|
||||
kvp.Value.Add(item);
|
||||
else
|
||||
kvp.Value.Insert(insertIndex, item);
|
||||
|
||||
m_Count++;
|
||||
|
||||
inserted = true;
|
||||
}
|
||||
|
||||
if (kvp.Value.Count == 0)
|
||||
m_PriorityToQueue.Remove(kvp.Key);
|
||||
}
|
||||
|
||||
if (!inserted)
|
||||
Enqueue(item, priority);
|
||||
Enqueue(item, priority);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue