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/T2FloorPtrList.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2FloorPtrList.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/T2DLL/T2FloorPtrList.cpp b/src/T2DLL/T2FloorPtrList.cpp index b72c96f..f716e76 100644 --- a/src/T2DLL/T2FloorPtrList.cpp +++ b/src/T2DLL/T2FloorPtrList.cpp @@ -1,10 +1,38 @@ #include "T2FloorPtrList.h" +#include "T2Tenant.h" +#include "T2TenantArray.h" +#include "T2TenantArrayList.h" -T2FloorPtrList::T2FloorPtrList(T2TenantArrayList*) { +T2FloorPtrList::T2FloorPtrList(T2TenantArrayList* inList) { + LArrayIterator iterator(*inList); + T2TenantArray *theArray; + + while (iterator.Next(&theArray)) { + for (int i = 0; i < T2TenantArray::kGroupSize; i++) { + T2Tenant *theTenant = theArray->GetIndexTenant(i); + if (theTenant->IsUsed() && theTenant->IsFloor() && theTenant->IsBuildFinish()) + AddItem(theTenant); + } + } } /*virtual*/ T2FloorPtrList::~T2FloorPtrList() { } -int T2FloorPtrList::CalcDistance(int, int) { +int T2FloorPtrList::CalcDistance(int inIndexA, int inIndexB) { + int distance = -1; + T2Tenant *theFloorA = (T2Tenant *) GetItem(inIndexA); + T2Tenant *theFloorB = (T2Tenant *) GetItem(inIndexB); + + if (theFloorA && theFloorB) { + RECT rectA, rectB; + theFloorA->GetEquipArea(rectA); + theFloorB->GetEquipArea(rectB); + + distance = (rectA.bottom - 1) - (rectB.bottom - 1); + if (distance < 0) + distance *= -1; + } + + return distance; } |