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/T2StairModule.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to 'src/T2DLL/T2StairModule.cpp')
-rw-r--r-- | src/T2DLL/T2StairModule.cpp | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/T2DLL/T2StairModule.cpp b/src/T2DLL/T2StairModule.cpp index 3a63e43..751943f 100644 --- a/src/T2DLL/T2StairModule.cpp +++ b/src/T2DLL/T2StairModule.cpp @@ -1,19 +1,57 @@ +#include "T2Archive.h" +#include "T2FloorInfo.h" +#include "T2People.h" +#include "T2PeopleLinkIterator.h" #include "T2StairModule.h" +#include "T2Tenant.h" +#include "T2TowerDoc.h" T2StairModule::T2StairModule() { + SetRectEmpty(&mModuleRect); } /*virtual*/ T2StairModule::~T2StairModule() { } -void T2StairModule::MoverIDChanged(unsigned int) { +void T2StairModule::MoverIDChanged(unsigned int moverID) { + if (mLink1) { + T2PeopleLinkIterator iterator((T2People *) mLink1); + T2People *people; + + while (iterator.Next(&people)) { + if (people) + people->mCurrEquipID = moverID; + } + } } -/*virtual*/ void T2StairModule::RemoveContents(T2TowerDoc*) { +/*virtual*/ void T2StairModule::RemoveContents(T2TowerDoc* towerDoc) { + T2FloorInfo *floorInfo = towerDoc->towerDoc_vf12C(); + + while (mLink1) { + T2People *people = (T2People *) mLink1; + Leave(people); + + POINT pt = mModuleRect.TopLeft(); + if (mDirection != kStairDirection1) + pt.y = mModuleRect.bottom - 1; + + T2Tenant *floor = floorInfo->GetFloor(pt.y, pt.x); + if (floor) + floor->Enter(people); + } } -/*virtual*/ void T2StairModule::LoadSelf(T2Archive&, T2TowerDoc*) { +/*virtual*/ void T2StairModule::LoadSelf(T2Archive& archive, T2TowerDoc* towerDoc) { + T2MoverModule::LoadSelf(archive, towerDoc); + + if (IsUsed()) + archive.ReadSRect(mModuleRect); } -/*virtual*/ void T2StairModule::SaveSelf(T2Archive&) { +/*virtual*/ void T2StairModule::SaveSelf(T2Archive& archive) { + T2MoverModule::SaveSelf(archive); + + if (IsUsed()) + archive.WriteSRect(mModuleRect); } |