Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
LongList.cs
Go to the documentation of this file.
2
3internal sealed class LongList
4{
5 private long[] _values;
6
7 private int _count;
8
9 private int _totalItems;
10
11 private int _currentItem;
12
13 internal int Count => _count;
14
15 internal long Current => _values[_currentItem];
16
17 internal LongList()
18 : this(2)
19 {
20 }
21
22 internal LongList(int startingSize)
23 {
24 _count = 0;
25 _totalItems = 0;
26 _values = new long[startingSize];
27 }
28
29 internal void Add(long value)
30 {
31 if (_totalItems == _values.Length)
32 {
34 }
36 _count++;
37 }
38
39 internal void StartEnumeration()
40 {
41 _currentItem = -1;
42 }
43
44 internal bool MoveNext()
45 {
46 while (++_currentItem < _totalItems && _values[_currentItem] == -1)
47 {
48 }
49 return _currentItem != _totalItems;
50 }
51
52 internal bool RemoveElement(long value)
53 {
54 int i;
55 for (i = 0; i < _totalItems && _values[i] != value; i++)
56 {
57 }
58 if (i == _totalItems)
59 {
60 return false;
61 }
62 _values[i] = -1L;
63 return true;
64 }
65
66 private void EnlargeArray()
67 {
68 int num = _values.Length * 2;
69 if (num < 0)
70 {
71 num = int.MaxValue;
72 }
73 long[] array = new long[num];
75 _values = array;
76 }
77}
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624