summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2UnitInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/T2DLL/T2UnitInfo.cpp')
-rw-r--r--src/T2DLL/T2UnitInfo.cpp70
1 files changed, 62 insertions, 8 deletions
diff --git a/src/T2DLL/T2UnitInfo.cpp b/src/T2DLL/T2UnitInfo.cpp
index 15660b5..4b137e8 100644
--- a/src/T2DLL/T2UnitInfo.cpp
+++ b/src/T2DLL/T2UnitInfo.cpp
@@ -1,40 +1,94 @@
+#include "CResFile.h"
+#include "T2Archive.h"
#include "T2UnitInfo.h"
T2UnitInfo::T2UnitInfo() {
+ mVarA = 0;
+ mVarB = 0;
}
T2UnitInfo::~T2UnitInfo() {
}
-int T2UnitInfo::IsBuildable() {
+BOOL T2UnitInfo::IsBuildable() {
+ return ((mVarA & 0x8000) == 0);
}
-int T2UnitInfo::IsMoverID(unsigned int) {
+BOOL T2UnitInfo::IsMoverID(unsigned int id) {
+ return (id > 0) && (id < 1000);
}
-int T2UnitInfo::IsRequestID(unsigned int) {
+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) {
+void T2UnitInfo::FillTenantID(unsigned int tenantID) {
+ mVarB &= 0x8000;
+ mVarB += tenantID;
}
-void T2UnitInfo::FillMoverID(unsigned int) {
+void T2UnitInfo::FillMoverID(unsigned int moverID) {
+ mVarA &= 0x8000;
+ mVarA += moverID;
}
-void T2UnitInfo::InitMask(CResFile&) {
+void T2UnitInfo::InitMask(CResFile& resFile) {
+ int v;
+
+ resFile >> v;
+ if (v != 0)
+ mVarA |= 0x8000;
+ else
+ mVarA &= ~0x8000;
}
-void T2UnitInfo::Read(T2Archive&, T2TowerDoc*) {
+void T2UnitInfo::Read(T2Archive& archive, T2TowerDoc*) {
+ unsigned short v;
+
+ archive >> v;
+ mVarA = v;
+ archive >> v;
+ mVarB = v;
}
-void T2UnitInfo::Write(T2Archive&) {
+void T2UnitInfo::Write(T2Archive& archive) {
+ unsigned short v;
+
+ v = mVarA;
+ archive << v;
+ v = mVarB;
+ archive << v;
}