blob: eba62bb3efb94c9d02bab49686c84f4221388cd3 (
plain)
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
|
#if defined _gamechaos_stocks_arrays_included
#endinput
#endif
#define _gamechaos_stocks_arrays_included
#define GC_ARRAYS_VERSION 0x01_00_00
#define GC_ARRAYS_VERSION_STRING "1.0.0"
/**
* Copies an array into an arraylist.
*
* @param array Arraylist Handle.
* @param index Index in the arraylist.
* @param values Array to copy.
* @param size Size of the array to copy.
* @param offset Arraylist offset to set.
* @return Number of cells copied.
* @error Invalid Handle or invalid index.
*/
stock int GCSetArrayArrayIndexOffset(ArrayList array, int index, const any[] values, int size, int offset)
{
int cells;
for (int i; i < size; i++)
{
array.Set(index, values[i], offset + i);
cells++;
}
return cells;
}
/**
* Copies an arraylist's specified cells to an array.
*
* @param array Arraylist Handle.
* @param index Index in the arraylist.
* @param result Array to copy to.
* @param size Size of the array to copy to.
* @param offset Arraylist offset.
* @return Number of cells copied.
* @error Invalid Handle or invalid index.
*/
stock int GCCopyArrayArrayIndex(const ArrayList array, int index, any[] result, int size, int offset)
{
int cells;
for (int i = offset; i < (size + offset); i++)
{
result[i] = array.Get(index, i);
cells++;
}
return cells;
}
|