blob: 2781c50b9d17654162809498da7c331d9a588b00 (
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
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
90
91
92
93
94
95
|
#include "StdAfx.h"
#include "CResFile.h"
#include "T2Archive.h"
#include "T2UnitInfo.h"
T2UnitInfo::T2UnitInfo() {
mVarA = 0;
mVarB = 0;
}
T2UnitInfo::~T2UnitInfo() {
}
BOOL T2UnitInfo::IsBuildable() {
return ((mVarA & 0x8000) == 0);
}
BOOL T2UnitInfo::IsMoverID(unsigned int id) {
return (id > 0) && (id < 1000);
}
BOOL T2UnitInfo::IsRequestID(unsigned int id) {
return (id >= 1000);
}
unsigned int T2UnitInfo::GetTenantID() {
unsigned int tenantID = 0;
if (mVarB)
tenantID = mVarB & 0x7FFF;
return tenantID;
}
unsigned int T2UnitInfo::GetMoverID() {
unsigned int moverID = 0;
if (mVarA) {
moverID = mVarA & 0x7FFF;
if (!IsMoverID(moverID))
moverID = 0;
}
return moverID;
}
unsigned int T2UnitInfo::GetRequestID() {
unsigned int requestID = 0;
if (mVarA) {
requestID = mVarA & 0x7FFF;
if (!IsRequestID(requestID))
requestID = 0;
}
return requestID;
}
void T2UnitInfo::FillTenantID(unsigned int tenantID) {
mVarB &= 0x8000;
mVarB += tenantID;
}
void T2UnitInfo::FillMoverID(unsigned int moverID) {
mVarA &= 0x8000;
mVarA += moverID;
}
void T2UnitInfo::InitMask(CResFile& resFile) {
int v;
resFile >> v;
if (v != 0)
mVarA |= 0x8000;
else
mVarA &= ~0x8000;
}
void T2UnitInfo::Read(T2Archive& archive, T2TowerDoc*) {
unsigned short v;
archive >> v;
mVarA = v;
archive >> v;
mVarB = v;
}
void T2UnitInfo::Write(T2Archive& archive) {
unsigned short v;
v = mVarA;
archive << v;
v = mVarB;
archive << v;
}
|