Move remqueue to engine (#4700)
This commit is contained in:
@@ -9,7 +9,6 @@ using Content.Server.Administration.Managers;
|
|||||||
using Content.Server.Afk;
|
using Content.Server.Afk;
|
||||||
using Content.Server.Chat.Managers;
|
using Content.Server.Chat.Managers;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Collections;
|
|
||||||
using Content.Shared.Voting;
|
using Content.Shared.Voting;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Content.Shared.Collections
|
|
||||||
{
|
|
||||||
// It's a Remie Queue now.
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Simple helper struct for "iterate collection and have a queue of things to remove when you're done",
|
|
||||||
/// to avoid concurrent iteration/modification.
|
|
||||||
/// </summary>
|
|
||||||
public struct RemQueue<T>
|
|
||||||
{
|
|
||||||
public List<T>? List;
|
|
||||||
|
|
||||||
public void Add(T t)
|
|
||||||
{
|
|
||||||
List ??= new();
|
|
||||||
List.Add(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Enumerator GetEnumerator()
|
|
||||||
{
|
|
||||||
return new(List);
|
|
||||||
}
|
|
||||||
|
|
||||||
public struct Enumerator : IEnumerator<T>
|
|
||||||
{
|
|
||||||
private readonly bool _filled;
|
|
||||||
private List<T>.Enumerator _enumerator;
|
|
||||||
|
|
||||||
public Enumerator(List<T>? list)
|
|
||||||
{
|
|
||||||
if (list == null)
|
|
||||||
{
|
|
||||||
_filled = false;
|
|
||||||
_enumerator = default;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_filled = true;
|
|
||||||
_enumerator = list.GetEnumerator();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveNext()
|
|
||||||
{
|
|
||||||
if (!_filled)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _enumerator.MoveNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IEnumerator.Reset()
|
|
||||||
{
|
|
||||||
if (_filled)
|
|
||||||
{
|
|
||||||
((IEnumerator) _enumerator).Reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public T Current => _enumerator.Current;
|
|
||||||
|
|
||||||
object? IEnumerator.Current => Current;
|
|
||||||
|
|
||||||
void IDisposable.Dispose()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Collections;
|
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Content.Shared.Physics.Pull;
|
using Content.Shared.Physics.Pull;
|
||||||
|
|||||||
Reference in New Issue
Block a user