blob: 1aee876499db9c22381b685013740a1092b5b8cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
#include "T2EquipPtrList.h"
#include "T2RegistedTenantDB.h"
#include "T2RouteNavigator.h"
#include "T2Tenant.h"
#include "T2TenantArray.h"
#include "T2TenantArrayList.h"
T2RegistedTenantDB::T2RegistedTenantDB()
: LArray(sizeof(T2EquipPtrList *))
{
}
/*virtual*/ T2RegistedTenantDB::~T2RegistedTenantDB() {
LArrayIterator iterator(*this);
T2EquipPtrList *equipPtrList;
while (iterator.Next(&equipPtrList))
delete equipPtrList;
}
void T2RegistedTenantDB::Init(T2TenantArrayList* tenantArrayList) {
LArrayIterator iterator(*tenantArrayList);
T2TenantArray *tenantArray;
while (iterator.Next(&tenantArray)) {
for (int i = 0; i < 128; i++) {
T2Tenant *tenant = tenantArray->GetIndexTenant(i);
if (tenant->IsUsed() && !tenant->IsFloor())
AddItem(tenant);
}
}
}
void T2RegistedTenantDB::AddItem(T2Tenant* tenant) {
if (tenant->IsRegist()) {
unsigned int theRegistID = tenant->GetRegistID();
T2EquipPtrList *theList = GetList(theRegistID);
if (theList) {
theList->AddItem(tenant);
} else {
theList = new T2EquipPtrList(theRegistID);
#line 55
_ASSERT(theList != NULL);
theList->AddItem(tenant);
InsertItemsAt(1, mItemCount + 1, &theList);
}
}
}
void T2RegistedTenantDB::RemoveItem(T2Tenant* tenant) {
if (tenant->IsRegist()) {
unsigned int theRegistID = tenant->GetRegistID();
T2EquipPtrList *theList = GetList(theRegistID);
if (theList)
theList->RemoveItem(tenant);
}
}
T2EquipPtrList* T2RegistedTenantDB::GetList(unsigned int registID) const {
T2EquipPtrList *result = NULL;
LArrayIterator iterator(*this);
T2EquipPtrList *list;
while (!result && iterator.Next(&list)) {
if (list->GetAttribute() == registID)
result = list;
}
return result;
}
T2Tenant* T2RegistedTenantDB::GetFirstTenant(unsigned int registID) const {
T2Tenant *theFirstTenant = NULL;
T2EquipPtrList *theList = GetList(registID);
if (theList)
theFirstTenant = (T2Tenant *) theList->GetItem(1);
return theFirstTenant;
}
T2Tenant* T2RegistedTenantDB::SearchToilet(const T2RouteNavigator* inNavi, POINT inPt, int& outVar) const {
T2Tenant *theSearchToilet = NULL;
outVar = -1;
T2EquipPtrList *theRegistList = GetList(kTenantRegistID7);
if (theRegistList) {
LArrayIterator theTenantIter(*theRegistList);
T2Tenant *theTenant;
while (outVar != 0 && theTenantIter.Next(&theTenant)) {
POINT entrancePt = theTenant->GetEntrancePt();
if (inNavi->CheckRoute(inPt, entrancePt, theTenant->GetCustomerSearchScore())) {
int status = theTenant->GetStatus();
if (status > kTenantStatus9 && status < kTenantStatus10000) {
if (!theTenant->WillBeFull()) {
theSearchToilet = theTenant;
outVar = 0;
} else {
outVar = -2;
}
}
}
}
}
return theSearchToilet;
}
T2Tenant* T2RegistedTenantDB::FindEmptyParking() const {
T2Tenant *theParking = NULL;
T2EquipPtrList *theRegistList = GetList(kTenantRegistID3);
if (theRegistList) {
LArrayIterator theTenantIter(*theRegistList);
T2Tenant *theTenant;
while (!theParking && theTenantIter.Next(&theTenant)) {
if (theTenant->IsEmptyParking())
theParking = theTenant;
}
}
return theParking;
}
T2Tenant* T2RegistedTenantDB::FindHisParking(T2People* people) const {
T2Tenant *hisParking = NULL;
T2EquipPtrList *theRegistList = GetList(kTenantRegistID3);
if (theRegistList) {
LArrayIterator theTenantIter(*theRegistList);
T2Tenant *theTenant;
while (!hisParking && theTenantIter.Next(&theTenant)) {
if (theTenant->IsBelongPeople(people))
hisParking = theTenant;
}
}
return hisParking;
}
|