-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path1007210.sqf
90 lines (78 loc) · 2.12 KB
/
1007210.sqf
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
78
79
80
81
82
83
84
85
86
87
88
89
dnicearr_update = {
private["_arr", "_key", "_val", "_upd", "_i"];
_arr = _this select 0;
_key = _this select 1;
_val = _this select 2;
_upd = false;
for [{_i=0}, {_i < (count _arr)}, {_i=_i+1}] do {
if ( ((_arr select _i) select 0) == _key ) exitWith {
(_arr select _i) SET [1, _val];
_upd = true;
};
};
if (!_upd) then {
_arr = _arr + [ [_key, _val] ];
};
_arr
};
dnicearr_length = {
(count _this)
};
dnicearr_keys = {
private["_result", "_i"];
_result = [];
for [{_i=0}, {_i < (count _this)}, {_i=_i+1}] do {
_result = _result + [ ((_this select _i) select 0)];
};
_result
};
dnicearr_values = {
private["_result", "_i"];
_result = [];
for [{_i=0}, {_i < (count _this)}, {_i=_i+1}] do {
_result = _result + [ ((_this select _i) select 1)];
};
_result
};
dnicearr_hasKey = {
( (_this select 1) in ((_this select 0) call dnicearr_keys) )
};
dnicearr_delete = {
private["_arr", "_key", "_del", "_i"];
_arr = _this select 0;
_key = _this select 1;
for [{_i=0}, {_i <(count _arr)}, {_i=_i+1}] do {
if ( ((_arr select _i) select 0) == _key ) exitWith {
_arr SET [_i, ""];
_arr = _arr - [""];
};
};
_arr
};
dnicearr_equals = {
( (format["%1", _this select 0]) == (format["%1", _this select 1]) )
};
dnicearr_getValue = {
private ["_c", "_arr", "_key"];
_arr = _this select 0;
_key = _this select 1;
for [{_c=0}, {_c < (count _arr)}, {_c=_c+1}] do {
if (((_arr select _c) select 0) == _key) exitWith {
((_arr select _c) select 1)
};
};
};
dnicearr_countMultiple = {
private ["_c", "_Farr", "_Fval", "_Fcount"];
_Farr = _this select 0;
_Fval = _this select 1;
_Fcount = 0;
for [{_c=0}, { _c < (count _Farr)}, {_c=_c+1}] do {
if ( (typeName (_Farr select _c)) == (typeName _Fval) ) then {
if ((_Farr select _c) == _Fval) then {
_Fcount = _Fcount + 1;
};
};
};
_Fcount
};