diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-06-28 22:22:32 +0100 |
commit | c0c336500955a23e344651e5412c9d9d441ef4ee (patch) | |
tree | 790769c748db307cf3314f6e896e2f61c68561a2 /src/T2DLL/T2Mover.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to 'src/T2DLL/T2Mover.cpp')
-rw-r--r-- | src/T2DLL/T2Mover.cpp | 724 |
1 files changed, 678 insertions, 46 deletions
diff --git a/src/T2DLL/T2Mover.cpp b/src/T2DLL/T2Mover.cpp index 9472651..df3d264 100644 --- a/src/T2DLL/T2Mover.cpp +++ b/src/T2DLL/T2Mover.cpp @@ -1,139 +1,771 @@ +#include "GlobalFunc.h" +#include "T2Archive.h" +#include "T2ElvModuleList.h" +#include "T2FloorInfo.h" #include "T2Mover.h" +#include "T2MoverCEArray.h" +#include "T2MoverDef.h" +#include "T2MoverModule.h" +#include "T2MoverModuleList.h" +#include "T2Name.h" +#include "T2NameList.h" +#include "T2People.h" +#include "T2PeopleLinkIterator.h" +#include "T2Request.h" +#include "T2RequestIDArray.h" +#include "T2RouteNavigator.h" +#include "T2StairModuleList.h" +#include "T2TemplatePluginList.h" +#include "T2Tenant.h" +#include "T2TowerDoc.h" +#include "T2TowerMainView.h" +#include "UT2Coordinate.h" T2Mover::T2Mover() { + mShowShaft = true; + mLength = 0; + mReqIDArray = NULL; + mShowShaft = true; + mCheckRequest = false; + mWaitCount = 0; + mCapacity = 0; + mMaxModule = 0; + mModuleList = NULL; + + mReqIDArray = new T2RequestIDArray; +#line 27 + _ASSERT(mReqIDArray != NULL); } /*virtual*/ T2Mover::~T2Mover() { + if (mReqIDArray) + delete mReqIDArray; + if (mModuleList) + delete mModuleList; } -/*virtual*/ void T2Mover::SetUsed(int) { +/*virtual*/ void T2Mover::SetUsed(BOOL used) { + if (!used) { + T2TowerDoc *theTowerDoc = GetCurrentT2TowerDoc(); +#line 48 + _ASSERT(theTowerDoc != NULL); + + T2NameList *theNameDB = theTowerDoc->mNameDB; +#line 51 + _ASSERT(theNameDB != NULL); + + T2Name *theName = theNameDB->Search(this, true); + if (theName) { + theNameDB->RemoveName(theName); + delete theName; + } + + theName = theNameDB->Search(this, false); + if (theName) { + theNameDB->RemoveName(theName); + delete theName; + } + + if (IsStair() && mModuleList) { + LArrayIterator iterator(*mModuleList); + T2MoverModule *theModule; + while (iterator.Next(&theModule)) { + theName = theNameDB->Search(theModule, true); + if (theName) { + theNameDB->RemoveName(theName); + delete theName; + } + + theName = theNameDB->Search(theModule, false); + if (theName) { + theNameDB->RemoveName(theName); + delete theName; + } + } + } + + if (mModuleList) { + delete mModuleList; + mModuleList = NULL; + } + + if (mReqIDArray) + mReqIDArray->AllClear(); + } + + T2Equip::SetUsed(used); } -int T2Mover::InitMover(T2MoverDef*, const RECT&, unsigned int) { +BOOL T2Mover::InitMover(T2MoverDef* moverDef, const RECT& baseRect, unsigned int valiation) { + BOOL result = true; + + T2Equip::InitEquip(moverDef, baseRect, valiation); + + mStatus = kMoverStatus0; + mCEArray = new T2MoverCEArray; + mMaxModule = moverDef->GetMaxModule(); + mLength = moverDef->mHeight; + mWaitCount = moverDef->GetDefaultWait(); + mShowShaft = true; + + if (mReqIDArray) { + mReqIDArray->Init(baseRect); + + RECT addSize; + moverDef->GetAddSize(addSize); + UT2Coordinate::AddRect(mArea, addSize); + } else { + result = false; + } + + return result; } -int T2Mover::InitStair(T2MoverDef*, const RECT&, unsigned int) { +BOOL T2Mover::InitStair(T2MoverDef* moverDef, const RECT& baseRect, unsigned int valiation) { + BOOL result = true; + + InitMover(moverDef, baseRect, 0); + + mModuleList = new T2StairModuleList; + if (mModuleList) { + result = mModuleList->Init(moverDef, baseRect); + } else { + result = false; + } + + return result; } -int T2Mover::InitElevator(T2MoverDef*, const RECT&, unsigned int) { +BOOL T2Mover::InitElevator(T2MoverDef* moverDef, const RECT& baseRect, unsigned int valiation) { + BOOL result = true; + + InitMover(moverDef, baseRect, valiation); + + mModuleList = new T2ElvModuleList; + if (mModuleList) { + result = mModuleList->Init(moverDef, baseRect); + } else { + result = false; + } + + return result; } -void T2Mover::GetTypicalName(CString&) const { +void T2Mover::GetTypicalName(CString& outStr) const { + T2EquipDef *equipDef = GetEquipDef(); + if (equipDef) + equipDef->GetName(outStr, 0); + else + outStr = ""; } -/*virtual*/ PROCCODE T2Mover::DoDestruct(T2TowerDoc*, POINT, RECT&) { +/*virtual*/ PROCCODE T2Mover::DoDestruct(T2TowerDoc* towerDoc, POINT pt, RECT& rect) { + PROCCODE result = GetEquipDef()->DoDestructProc(towerDoc, this, pt, rect); + + if (result == ProcCode_0) { + PARTCODE partCode = GetPartFromPoint(towerDoc, pt, NULL); + if (partCode == PartCode_2) { + GetEquipArea(rect); + T2FloorInfo *theFloorInfo = towerDoc->mFloorInfo; + + for (int i = 0; i < mLength; i++) { + if (IsStopPosition(i)) + RemoveStopBoth(towerDoc, i); + } + + theFloorInfo->FillMoverID(rect, 0); + theFloorInfo->UpdeteRequestByRemoveMover(rect); + + GetEquipDef()->DestructFinish(towerDoc, this); + SetUsed(false); + return ProcCode_1; + } else if (partCode == PartCode_4) { + GetEquipArea(rect); + return ProcCode_1; + } else { + return ProcCode_1; + } + } + + return result; } -/*virtual*/ int T2Mover::Destruct(T2TowerDoc*, CRect&) { +/*virtual*/ BOOL T2Mover::Destruct(T2TowerDoc* towerDoc, CRect& rect) { + GetEquipArea(rect); + + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + mModuleList->Destruct(towerDoc); + + for (int i = 0; i < mLength; i++) { + if (IsStopPosition(i)) + RemoveStopBoth(towerDoc, i); + } + + theFloorInfo->FillMoverID(rect, 00); + theFloorInfo->UpdeteRequestByRemoveMover(rect); + + SetUsed(false); + + BOOL result = true; + + towerDoc->towerDoc_vf124()->MoverRemoved(this, 1); + + return result; } -/*virtual*/ void T2Mover::Draw(T2TowerDoc*, const RECT&) { +/*virtual*/ void T2Mover::Draw(T2TowerDoc* towerDoc, const RECT& rect) { + if (GetEquipDef()) + GetEquipDef()->DrawProc(this, mArea, towerDoc); } int T2Mover::GetNumStop() const { + int count = 0; + + for (int i = 0; i < mLength; i++) { + if (IsStopPosition(i)) + count++; + } + + return count; } -void T2Mover::AddStopBoth(T2TowerDoc*, int) { +void T2Mover::AddStopBoth(T2TowerDoc* towerDoc, int position) { + BOOL ok = false; + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + + ok |= AddStop(theFloorInfo, position, ERequestUpDown_0); + ok |= AddStop(theFloorInfo, position, ERequestUpDown_1); + + if (mModuleList && ok) + mModuleList->StopAdded(towerDoc, this, position); } -int T2Mover::AddStop(T2FloorInfo*, int, ERequestUpDown) { +BOOL T2Mover::AddStop(T2FloorInfo* floorInfo, int position, ERequestUpDown upDown) { + BOOL result = false; + + POINT stopPt = PositionToStopPt(position, upDown); + T2Tenant *theFloor = floorInfo->GetFloor(stopPt.y, stopPt.x); + + if (theFloor) { + CRect rect; + GetEquipArea(rect); + + if (rect.Height() == 1 || stopPt.y == (rect.bottom - 1)) { + if (!IsStopPosition(position)) + AddCrossEquipID(floorInfo, position); + + if (mReqIDArray) { + T2Request *theRequest = floorInfo->FindUnusedRequest(); + if (theRequest) { + mReqIDArray->SetRequestIDAt(position, upDown, theRequest->GetRequestID()); + POINT stopPt2 = PositionToStopPt(position, upDown); + theRequest->InitRequest(floorInfo, mEquipID, stopPt2, upDown); + } + } + + result = true; + } + } + + return result; } -void T2Mover::RemoveStopBoth(T2TowerDoc*, int) { +void T2Mover::RemoveStopBoth(T2TowerDoc* towerDoc, int position) { + RemoveStop(towerDoc, position, ERequestUpDown_0); + RemoveStop(towerDoc, position, ERequestUpDown_1); + + RemoveCrossEquipID(towerDoc->towerDoc_vf12C(), position); + mReqIDArray->StopRemoved(towerDoc, PositionToUnit(position)); + + if (mModuleList) + mModuleList->StopRemoved(towerDoc, this, position); } -void T2Mover::RemoveStop(T2TowerDoc*, int, ERequestUpDown) { +void T2Mover::RemoveStop(T2TowerDoc* towerDoc, int position, ERequestUpDown upDown) { + if (mReqIDArray) + mReqIDArray->RemoveRequest(towerDoc, position, upDown); } -void T2Mover::RemoveCrossEquipID(T2FloorInfo*, int) { +void T2Mover::RemoveCrossEquipID(T2FloorInfo* floorInfo, int position) { + POINT stopPt = PositionToStopPt(position, ERequestUpDown_0); + T2Tenant *theFloor = floorInfo->GetFloor(stopPt.y, stopPt.x); + + if (theFloor) { + RemoveCEID(theFloor->GetEquipID()); + theFloor->RemoveCEID(mEquipID); + } } -void T2Mover::RemoveUnstoppable(T2TowerDoc*) { +void T2Mover::RemoveUnstoppable(T2TowerDoc* towerDoc) { + T2MoverDef *theMoverDef = (T2MoverDef *) GetEquipDef(); + BOOL changed = false; + + for (int i = 0; i < mLength; i++) { + if (IsStopPosition(i) && !theMoverDef->IsaKindOfStopProc(towerDoc, this, i, 0)) { + RemoveStopBoth(towerDoc, i); + changed = true; + } + } + + if (changed) + towerDoc->GetTowerMainView()->tmv_vf128(mArea); } -void T2Mover::AddCrossEquipID(T2FloorInfo*, int) { +void T2Mover::AddCrossEquipID(T2FloorInfo* floorInfo, int position) { + POINT stopPt = PositionToStopPt(position, ERequestUpDown_0); + T2Tenant *theFloor = floorInfo->GetFloor(stopPt.y, stopPt.x); + + if (theFloor) + theFloor->AddCEMoverID(floorInfo, stopPt, mEquipID); + AddCEFloorID(floorInfo, position); } -void T2Mover::AddCEFloorID(T2FloorInfo*, int) { +void T2Mover::AddCEFloorID(T2FloorInfo* floorInfo, int position) { + POINT stopPt = PositionToStopPt(position, ERequestUpDown_0); + unsigned int floorID = floorInfo->GetFloorID(stopPt.y, stopPt.x); + + if (floorID != 0) { + int i; + for (i = position - 1; i >= 0; i--) { + if (IsStopPosition(i)) + break; + } + + unsigned int idA = 0; + if (i >= 0) + floorInfo->GetFloorID(stopPt.y, stopPt.x - (position - i)); + + InsertCEID(idA, floorID); + } } -void T2Mover::ReplaceID(T2FloorInfo*, unsigned int) { +void T2Mover::ReplaceID(T2FloorInfo* floorInfo, unsigned int id) { + floorInfo->UpdateFloorCEArray(mArea, mEquipID, id); + floorInfo->FillMoverID(mArea, id); } -POINT T2Mover::PositionToStopPt(int, ERequestUpDown) { +POINT T2Mover::PositionToStopPt(int position, ERequestUpDown upDown) { + POINT result; + result.x = 0; + result.y = 0; + + T2MoverDef *theMoverDef = (T2MoverDef *) GetEquipDef(); + if (theMoverDef) { + RECT addSize; + theMoverDef->GetAddSize(addSize); + + result.y = mArea.bottom - 1 - addSize.bottom - position; + if (upDown == ERequestUpDown_0) + result.x = mArea.left; + else + result.x = mArea.right; + } + + return result; } -int T2Mover::UnitToPosition(int) const { +int T2Mover::UnitToPosition(int unit) const { + int result; + T2MoverDef *theMoverDef = (T2MoverDef *) GetEquipDef(); +#line 495 + _ASSERT(theMoverDef != NULL); + + RECT addSize; + theMoverDef->GetAddSize(addSize); + return mArea.bottom - 1 - addSize.bottom - unit; } -int T2Mover::PositionToUnit(int) const { +int T2Mover::PositionToUnit(int position) const { + int result = mArea.bottom - 1 - position; + + T2MoverDef *theMoverDef = (T2MoverDef *) GetEquipDef(); + if (theMoverDef) { + RECT addSize; + theMoverDef->GetAddSize(addSize); + result -= addSize.bottom; + } + + return result; } -int T2Mover::IsStopPosition(int) const { +BOOL T2Mover::IsStopPosition(int position) const { + BOOL result = false; + + if (position >= 0 && mCEArray && mReqIDArray->IsStopPosition(position)) + result = true; + + return result; } -int T2Mover::IsStopPosition(int, ERequestUpDown) { +BOOL T2Mover::IsStopPosition(int position, ERequestUpDown upDown) { + BOOL result = false; + + if (position >= 0 && mCEArray && mReqIDArray->GetRequestIDAt(position, upDown)) + result = true; + + return result; } -int T2Mover::AddModule(T2TowerDoc*, int) { +BOOL T2Mover::AddModule(T2TowerDoc* towerDoc, int position) { + BOOL result = false; + + if (GetModuleCount() < mMaxModule && mModuleList) { + ((T2ElvModuleList *) mModuleList)->AddModule(towerDoc, mLength, position); + result = true; + } + + return result; } -void T2Mover::AddStairModule(T2TowerDoc*, const RECT&, int) { +void T2Mover::AddStairModule(T2TowerDoc* towerDoc, const RECT& rect, BOOL insertAtEnd) { + if (mModuleList) + ((T2StairModuleList *) mModuleList)->AddModule(towerDoc, rect, insertAtEnd); } -unsigned int T2Mover::GetRequestID(int, int) const { +unsigned int T2Mover::GetRequestID(int position, BOOL isDown) const { + unsigned int result = 0; + + ERequestUpDown upDown = ERequestUpDown_0; + if (isDown) + upDown = ERequestUpDown_1; + + result = mReqIDArray->GetRequestIDAt(position, upDown); + return result; } int T2Mover::GetModuleCount() const { -} + int result = 0; -int T2Mover::FindStairModule(T2TowerDoc*, POINT, T2MoverModule*&, T2MoverModule*&) { -} + if (mModuleList) + result = mModuleList->GetModuleCount(); -int T2Mover::CalcModuleRect(const T2MoverModule*, RECT&, int&) const { + return result; } -T2MoverModule* T2Mover::FindPeople(const T2People*) const { -} +BOOL T2Mover::FindStairModule(T2TowerDoc* towerDoc, POINT pt, T2MoverModule*& module1, T2MoverModule*& module2) { + int var; + PARTCODE partCode = GetPartFromPoint(towerDoc, pt, &var); + BOOL result = (partCode == PartCode_2 && var >= 0); -void T2Mover::CalcMachineArea(EEquipPos, RECT&) const { -} + if (result) { + if (!mModuleList->FetchItemAt(var, &module1) || !mModuleList->FetchItemAt(var + 1, &module2)) + result = false; + } -void T2Mover::AdjustLength() { + return result; } -T2Request* T2Mover::GetRequest(T2FloorInfo*, int, int) const { +int T2Mover::CalcModuleRect(const T2MoverModule* module, RECT& rect, int& unk) const { + return ((T2MoverDef *) GetEquipDef())->CalcModuleRectProc(this, module, rect, unk); } -int T2Mover::CalcScore(int) const { -} +T2MoverModule* T2Mover::FindPeople(const T2People* inPeople) const { + T2MoverModule *result = NULL; + T2MoverModuleList *theList = GetModuleList(); -int T2Mover::ExpandArea(T2TowerDoc*, EEquipPos, int) { -} + if (theList) { + LArrayIterator moduleIterator(*theList); + T2MoverModule *moverModule; + + while (!result && moduleIterator.Next(&moverModule)) { + if (moverModule->IsUsed() && moverModule->mLink1) { + T2PeopleLinkIterator peopleIterator((T2People *) moverModule->mLink1); + T2People *people; -int T2Mover::IsHomePosition(int) const { + while (peopleIterator.Next(&people)) { + if (people == inPeople) { + result = moverModule; + break; + } + } + } + } + } + + return result; } -void T2Mover::CalcBodyArea(RECT&) const { +void T2Mover::CalcMachineArea(EEquipPos pos, RECT& rect) const { + rect = mArea; + +#line 672 + _ASSERT(mToolDef != NULL); + + RECT addSize; + ((T2MoverDef *) mToolDef)->GetAddSize(addSize); + + switch (pos) { + case EEquipPos_0: + rect.right = rect.left - addSize.left; + break; + case EEquipPos_1: + rect.left = rect.right - addSize.right; + break; + case EEquipPos_2: + rect.bottom = rect.top - addSize.top; + break; + case EEquipPos_3: + rect.top = rect.bottom - addSize.bottom; + break; + } } -int T2Mover::CalcModulePos(T2MoverModule*, ERequestUpDown) { +void T2Mover::AdjustLength() { + CRect rect; + CalcBodyArea(rect); + + mLength = rect.Height(); +} + +T2Request* T2Mover::GetRequest(T2FloorInfo* floorInfo, int position, BOOL isDown) const { + T2Request *result = NULL; + + unsigned int requestID = GetRequestID(position, isDown); + if (requestID) + result = floorInfo->GetRequest(requestID); + + return result; +} + +int T2Mover::CalcScore(int multiplier) const { + int result = 0x7FFF; + + if (GetEquipDef()) { + if (multiplier < 0) + multiplier *= -1; + + result = ((T2MoverDef *) GetEquipDef())->GetScore() * multiplier; + } + + return result; +} + +int T2Mover::ExpandArea(T2TowerDoc* towerDoc, EEquipPos pos, int count) { + int result = 0; + T2FloorInfo *theFloorInfo = towerDoc->towerDoc_vf12C(); + + RECT area = mArea; + + RECT addSize; + ((T2MoverDef *) mToolDef)->GetAddSize(addSize); + + switch (pos) { + case EEquipPos_2: + if (count < 0) { + for (int i = 0; i < -count; i++) { + int position = mLength - 1 - i; + if (IsStopPosition(position)) { + RemoveStopBoth(towerDoc, position); + result = 2; + } + } + } + + mArea.top -= count; + mLength += count; + mReqIDArray->Expand(ReqIDArrayPos_1, count); + ((T2ElvModuleList *) mModuleList)->MoverExpanded(this, EEquipPos_2, count); + + if (count > 0) { + area.bottom = area.top; + area.top -= count; + theFloorInfo->MoverAreaAdded(area, mEquipID); + area.bottom += -addSize.top; + } else { + area.bottom = area.top - count; + theFloorInfo->MoverAreaRemoved(area); + area.bottom += -addSize.top + 1; + } + + if (count > 0) { + RemoveUnstoppable(towerDoc); + T2MoverDef *theMoverDef = (T2MoverDef *) GetEquipDef(); + for (int i = 0; i < count; i++) { + int position = mLength - 1 - i; + if (theMoverDef->GetMaxStop() == 0 || GetNumStop() < theMoverDef->GetMaxStop()) { + if (theMoverDef->IsaKindOfStopProc(towerDoc, this, position, 1) && !IsStopPosition(position)) { + AddStopBoth(towerDoc, position); + result = 1; + } + } + } + } + + break; + + case EEquipPos_3: + if (count < 0) { + for (int position = 0; position < -count; position++) { + if (IsStopPosition(position)) { + RemoveStopBoth(towerDoc, position); + result = 2; + } + } + } + + mArea.bottom += count; + mLength += count; + mReqIDArray->Expand(ReqIDArrayPos_0, count); + ((T2ElvModuleList *) mModuleList)->MoverExpanded(this, EEquipPos_3, count); + + if (count > 0) { + area.top = area.bottom; + area.bottom += count; + theFloorInfo->MoverAreaAdded(area, mEquipID); + area.top -= addSize.bottom; + } else { + area.top = area.bottom + count; + theFloorInfo->MoverAreaRemoved(area); + area.top -= addSize.bottom + 1; + } + + if (count > 0) { + RemoveUnstoppable(towerDoc); + T2MoverDef *theMoverDef = (T2MoverDef *) GetEquipDef(); + for (int position = 0; position < count; position++) { + if (theMoverDef->GetMaxStop() == 0 || GetNumStop() < theMoverDef->GetMaxStop()) { + if (theMoverDef->IsaKindOfStopProc(towerDoc, this, position, 1) && !IsStopPosition(position)) { + AddStopBoth(towerDoc, position); + result = 1; + } + } + } + } + + break; + } + + if (count != 0) + towerDoc->GetTowerMainView()->tmv_vf128(area, true); + + return result; +} + +BOOL T2Mover::IsHomePosition(int position) const { + BOOL result = false; + + if (mModuleList) + result = ((T2ElvModuleList *) mModuleList)->IsHomePosition(position); + + return result; +} + +void T2Mover::CalcBodyArea(RECT& rect) const { + rect = mArea; + + if (GetEquipDef()) { + RECT addSize; + ((T2MoverDef *) GetEquipDef())->GetAddSize(addSize); + + rect.top -= addSize.top; + rect.left -= addSize.left; + rect.bottom -= addSize.bottom; + rect.right -= addSize.right; + } +} + +int T2Mover::CalcModulePos(T2MoverModule* module, ERequestUpDown upDown) { + return ((T2MoverDef *) GetEquipDef())->CalcModulePosProc(this, module, upDown); } void T2Mover::ShowShaft() { + if (!mShowShaft) { + mShowShaft = true; + + T2TowerDoc *theTowerDoc = GetCurrentT2TowerDoc(); + theTowerDoc->GetTowerMainView()->tmv_vf128(mArea); + } } void T2Mover::HideShaft() { + if (mShowShaft) { + mShowShaft = false; + + T2TowerDoc *theTowerDoc = GetCurrentT2TowerDoc(); + theTowerDoc->GetTowerMainView()->tmv_vf128(mArea); + theTowerDoc->towerDoc_vf12C()->SetTenantDrawModeByRect(mArea, DrawMode2); + } } -/*virtual*/ unsigned int T2Mover::Idle(T2TowerDoc*) { +/*virtual*/ unsigned int T2Mover::Idle(T2TowerDoc* towerDoc) { + unsigned int result = 0xFFFFFFFF; + result = ((T2MoverDef *) GetEquipDef())->IdleProc(this, towerDoc); + return result; } -/*virtual*/ void T2Mover::LoadSelf(T2Archive&, T2TowerDoc*) { +/*virtual*/ void T2Mover::LoadSelf(T2Archive& archive, T2TowerDoc* towerDoc) { + DWORD code; + archive >> code; +#line 1193 + _ASSERT(code == '<MV>'); + + T2Equip::LoadSelf(archive, towerDoc); + + if (IsUsed()) { + mToolDef = towerDoc->mMoverTemplates->FindMoverDef(mEquipType); + if (mToolDef) { + mAttribute = mToolDef->GetAttribute(); + mCapacity = GetEquipDef()->GetCapacity(); + } + + unsigned char uc; + short s; + + archive >> uc; + mShowShaft = (uc != 0); + + mCheckRequest = true; + + archive >> s; + mLength = s; + + mReqIDArray = T2RequestIDArray::ReadReqIDArray(archive); + + archive >> s; + mWaitCount = s; + archive >> s; + mMaxModule = s; + + mModuleList = T2MoverModuleList::ReadMMList(archive, towerDoc); + + archive >> mRefCon; + + if (GetEquipDef()) { + GetEquipDef()->LoadExtraData(archive, towerDoc, this); + } else { + int count; + archive >> count; + + for (int i = 0; i < count; i++) { + unsigned char tmp; + archive >> tmp; + } + } + } } -/*virtual*/ void T2Mover::SaveSelf(T2Archive&) { +/*virtual*/ void T2Mover::SaveSelf(T2Archive& archive) { + DWORD code = '<MV>'; + archive << code; + + T2Equip::SaveSelf(archive); + + if (IsUsed()) { + unsigned char uc; + uc = mShowShaft ? 1 : 0; + archive << uc; + + archive << (short) mLength; + T2RequestIDArray::WriteReqIDArray(mReqIDArray, archive); + archive << (short) mWaitCount; + archive << (short) mMaxModule; + T2MoverModuleList::WriteMMList(mModuleList, archive); + archive << mRefCon; + + GetEquipDef()->SaveExtraData(archive, this); + } } -/*virtual*/ T2InfoDialog* T2Mover::ShowInfoDialog(T2TowerDoc*, CPoint) { +/*virtual*/ T2InfoDialog* T2Mover::ShowInfoDialog(T2TowerDoc* towerDoc, CPoint pt) { + return ((T2MoverDef *) GetEquipDef())->ShowInfoDialog(towerDoc, this, pt); } |