blob: 527ee89b3a5245d2273e6e36066028604821edeb (
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
53
54
55
56
57
58
59
60
61
62
|
#include "StdAfx.h"
#include "T2MoverArray.h"
T2MoverArray::T2MoverArray(unsigned int inStartID)
: T2ObjectArray(inStartID)
{
for (unsigned int i = 0; i < kGroupSize; i++)
mMover[i].mEquipID = mStartID + i;
}
/*virtual*/ T2MoverArray::~T2MoverArray() {
}
T2Mover* T2MoverArray::FindUnusedMover() {
for (int i = 0; i < kGroupSize; i++) {
if (!mMover[i].IsUsed())
return &mMover[i];
}
return NULL;
}
void T2MoverArray::DrawMoverAll(T2TowerDoc* inDoc, const RECT& inRect) {
for (int i = 0; i < kGroupSize; i++) {
T2Mover *theMover = &mMover[i];
if (theMover->IsUsed()) {
RECT moverArea;
RECT intersection;
theMover->GetEquipArea(moverArea);
if (IntersectRect(&intersection, &moverArea, &inRect))
theMover->Draw(inDoc, inRect);
}
}
}
/*virtual*/ void T2MoverArray::DispatchIdle(T2TowerDoc* inDoc, int) {
for (int i = 0; i < kGroupSize; i++) {
if (mMover[i].IsUsed())
mMover[i].Idle(inDoc);
}
}
int T2MoverArray::CalcMentenanceCost(T2TowerDoc* inDoc) const {
int cost = 0;
for (int i = 0; i < kGroupSize; i++) {
if (mMover[i].IsUsed())
cost += mMover[i].CalcMentenanceCost(inDoc);
}
return cost;
}
void T2MoverArray::Read(T2Archive& inArchive, T2TowerDoc* inDoc) {
for (int i = 0; i < kGroupSize; i++)
mMover[i].Load(inArchive, inDoc);
}
void T2MoverArray::Write(T2Archive& inArchive) {
for (int i = 0; i < kGroupSize; i++)
mMover[i].Save(inArchive);
}
|