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/T2RegistedTenantIterator.cpp | |
parent | 37e364b2c6cc7487a1c888d256a73e5337bb7189 (diff) | |
download | t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.tar.gz t2win-c0c336500955a23e344651e5412c9d9d441ef4ee.zip |
first pass of T2DLL
Diffstat (limited to '')
-rw-r--r-- | src/T2DLL/T2RegistedTenantIterator.cpp | 65 |
1 files changed, 62 insertions, 3 deletions
diff --git a/src/T2DLL/T2RegistedTenantIterator.cpp b/src/T2DLL/T2RegistedTenantIterator.cpp index ee47955..c9597c0 100644 --- a/src/T2DLL/T2RegistedTenantIterator.cpp +++ b/src/T2DLL/T2RegistedTenantIterator.cpp @@ -1,13 +1,72 @@ +#include "T2EquipPtrList.h" +#include "T2RegistedTenantDB.h" #include "T2RegistedTenantIterator.h" +#include "T2RouteNavigator.h" +#include "T2Tenant.h" -T2RegistedTenantIterator::T2RegistedTenantIterator(const T2RegistedTenantDB*, unsigned int, const T2RouteNavigator*, POINT) { +T2RegistedTenantIterator::T2RegistedTenantIterator(const T2RegistedTenantDB* db, unsigned int registID, const T2RouteNavigator* routeNavigator, POINT point) { + mEquipPtrList = db->GetList(registID); + mRouteNavigator = routeNavigator; + + if (mEquipPtrList && mRouteNavigator) { + mIndex = 0; + mPoint = point; + } else { + mIndex = -2; + } } T2RegistedTenantIterator::~T2RegistedTenantIterator() { } -int T2RegistedTenantIterator::Next(T2Tenant*&) { +BOOL T2RegistedTenantIterator::Next(T2Tenant*& pTenant) { + BOOL result = false; + BOOL done = false; + T2Tenant *tenant = NULL; + + while (!done) { + mIndex++; + + if (mIndex > 0 && mEquipPtrList->FetchItemAt(mIndex, &tenant)) { + int status = tenant->GetStatus(); + if (status > 9 && status < 10000) { + POINT entrancePt = tenant->GetEntrancePt(); + if (mRouteNavigator->CheckRoute(mPoint, entrancePt, tenant->GetCustomerSearchScore())) { + pTenant = tenant; + result = true; + done = true; + } + } + } else { + done = true; + } + } + + return result; } -int T2RegistedTenantIterator::NextJob(T2Tenant*&) { +BOOL T2RegistedTenantIterator::NextJob(T2Tenant*& pTenant) { + BOOL result = false; + BOOL done = false; + T2Tenant *tenant = NULL; + + while (!done) { + mIndex++; + + if (mIndex > 0 && mEquipPtrList->FetchItemAt(mIndex, &tenant)) { + int status = tenant->GetStatus(); + if (status > 9 && status < 10000) { + POINT entrancePt = tenant->GetEntrancePt(); + if (mRouteNavigator->CheckRoute(mPoint, entrancePt, tenant->GetEmployeeSearchScore())) { + pTenant = tenant; + result = true; + done = true; + } + } + } else { + done = true; + } + } + + return result; } |