blob: 42adf1b3d3fb2a75b9d3b84a7e83e81cc61d0093 (
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
|
#include "T2MatterArray.h"
T2MatterArray::T2MatterArray(unsigned int jobType, unsigned int validRange, unsigned int startID)
: T2ObjectArray(startID)
{
mJobType = jobType;
mValidRange = validRange;
for (unsigned int i = 0; i < kGroupSize; i++)
mMatter[i].mMatterID = mStartID + i;
}
void T2MatterArray::SetValidRange(unsigned int validRange) {
if (validRange <= kGroupSize)
mValidRange = validRange;
}
T2Matter* T2MatterArray::FindUnusedMatter(unsigned int arg) {
for (unsigned int i = 0; i < mValidRange; i++) {
if (!mMatter[i].IsUsed())
return &mMatter[i];
}
if (arg > 0) {
unsigned int start = mValidRange;
unsigned int end = mValidRange + arg;
if (end > kGroupSize)
end = kGroupSize;
mValidRange = end;
for (unsigned int i = start; i < mValidRange; i++) {
if (!mMatter[i].IsUsed())
return &mMatter[i];
}
}
return NULL;
}
|