Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
BitMaskArray.c
Go to the documentation of this file.
1
//------------------------------------------------------------------------------------------------
5
//------------------------------------------------------------------------------------------------
6
class
SCR_BitMaskArray
7
{
9
private
ref array<int> m_BitMasks = null;
10
11
//------------------------------------------------------------------------------------------------
12
int
GetNumBitMasks()
13
{
14
return
m_BitMasks.Count();
15
}
16
17
//------------------------------------------------------------------------------------------------
18
int
GetBitMask(
int
index
)
19
{
20
return
m_BitMasks[
index
];
21
}
22
23
//------------------------------------------------------------------------------------------------
24
void
SetBitMask(
int
index
,
int
bitMask)
25
{
26
if
(
index
>= m_BitMasks.Count())
27
return
;
28
29
m_BitMasks[
index
] = bitMask;
30
}
31
32
//------------------------------------------------------------------------------------------------
33
bool
GetEmpty()
34
{
35
for
(
int
b = 0; b < m_BitMasks.Count(); b++)
36
{
37
int
bitMask = m_BitMasks.Get(b);
38
if
(bitMask != 0)
39
return
false
;
40
}
41
42
return
true
;
43
}
44
45
//------------------------------------------------------------------------------------------------
46
bool
GetBit(
int
index
)
47
{
48
int
bitMaskIndex =
Math
.Floor(
index
/ 32);
49
int
bitInMask = 1 << (
index
% 32);
50
51
int
bitMask = m_BitMasks.Get(bitMaskIndex);
52
53
if
(bitMask & bitInMask)
54
return
true
;
55
else
56
return
false
;
57
}
58
59
//------------------------------------------------------------------------------------------------
60
void
SetBit(
int
index
,
bool
bSet)
61
{
62
int
bitMaskIndex =
Math
.Floor(
index
/ 32);
63
int
bitInMask = 1 << (
index
% 32);
64
65
int
bitMask = m_BitMasks.Get(bitMaskIndex);
66
if
(bSet)
67
bitMask |= bitInMask;
68
else
69
bitMask &= ~bitInMask;
70
m_BitMasks.Set(bitMaskIndex, bitMask);
71
}
72
73
//------------------------------------------------------------------------------------------------
74
void
SCR_BitMaskArray(
int
maxBits)
75
{
76
int
numBitMasks =
Math
.Ceil(maxBits / 32);
77
m_BitMasks =
new
array<int>;
78
79
for
(
int
b = 0; b < numBitMasks; b++)
80
m_BitMasks.Insert(0);
81
}
82
83
//------------------------------------------------------------------------------------------------
84
void
~SCR_BitMaskArray()
85
{
86
}
87
};
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition
SCR_DestructionSynchronizationComponent.c:17
Math
Definition
Math.c:13
scripts
Game
Utilities
BitMaskArray.c
Generated by
1.17.0