Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
IntSizedArray.cs
Go to the documentation of this file.
2
3internal sealed class IntSizedArray : ICloneable
4{
5 internal int[] _objects = new int[16];
6
7 internal int[] _negObjects = new int[4];
8
9 internal int this[int index]
10 {
11 get
12 {
13 if (index < 0)
14 {
15 if (-index <= _negObjects.Length - 1)
16 {
17 return _negObjects[-index];
18 }
19 return 0;
20 }
21 if (index <= _objects.Length - 1)
22 {
23 return _objects[index];
24 }
25 return 0;
26 }
27 set
28 {
29 if (index < 0)
30 {
31 if (-index > _negObjects.Length - 1)
32 {
34 }
36 }
37 else
38 {
39 if (index > _objects.Length - 1)
40 {
42 }
44 }
45 }
46 }
47
49 {
50 }
51
53 {
54 _objects = new int[sizedArray._objects.Length];
55 sizedArray._objects.CopyTo(_objects, 0);
56 _negObjects = new int[sizedArray._negObjects.Length];
57 sizedArray._negObjects.CopyTo(_negObjects, 0);
58 }
59
60 public object Clone()
61 {
62 return new IntSizedArray(this);
63 }
64
65 internal void IncreaseCapacity(int index)
66 {
67 try
68 {
69 if (index < 0)
70 {
71 int num = Math.Max(_negObjects.Length * 2, -index + 1);
72 int[] array = new int[num];
75 }
76 else
77 {
78 int num2 = Math.Max(_objects.Length * 2, index + 1);
79 int[] array2 = new int[num2];
82 }
83 }
84 catch (Exception)
85 {
87 }
88 }
89}
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static string Serialization_CorruptedStream
Definition SR.cs:74
Definition SR.cs:7