-
Notifications
You must be signed in to change notification settings - Fork 0
/
RectangularArrays.cs
77 lines (68 loc) · 2.37 KB
/
RectangularArrays.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//----------------------------------------------------------------------------------------
// Copyright © 2007 - 2021 Tangible Software Solutions, Inc.
// This class can be used by anyone provided that the copyright notice remains intact.
//
// This class includes methods to convert Java rectangular arrays (jagged arrays
// with inner arrays of the same length).
//----------------------------------------------------------------------------------------
using OSRSCache.definitions;
internal static class RectangularArrays
{
public static int[][] RectangularIntArray(int size1, int size2)
{
int[][] newArray = new int[size1][];
for (int array1 = 0; array1 < size1; array1++)
{
newArray[array1] = new int[size2];
}
return newArray;
}
public static MapDefinition.Tile[][][] RectangularTileArray(int size1, int size2, int size3)
{
MapDefinition.Tile[][][] newArray = new MapDefinition.Tile[size1][][];
for (int array1 = 0; array1 < size1; array1++)
{
newArray[array1] = new MapDefinition.Tile[size2][];
if (size3 > -1)
{
for (int array2 = 0; array2 < size2; array2++)
{
newArray[array1][array2] = new MapDefinition.Tile[size3];
}
}
}
return newArray;
}
public static int[][][] RectangularIntArray(int size1, int size2, int size3)
{
int[][][] newArray = new int[size1][][];
for (int array1 = 0; array1 < size1; array1++)
{
newArray[array1] = new int[size2][];
if (size3 > -1)
{
for (int array2 = 0; array2 < size2; array2++)
{
newArray[array1][array2] = new int[size3];
}
}
}
return newArray;
}
public static byte[][][] RectangularbyteArray(int size1, int size2, int size3)
{
byte[][][] newArray = new byte[size1][][];
for (int array1 = 0; array1 < size1; array1++)
{
newArray[array1] = new byte[size2][];
if (size3 > -1)
{
for (int array2 = 0; array2 < size2; array2++)
{
newArray[array1][array2] = new byte[size3];
}
}
}
return newArray;
}
}