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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
#pragma once
#include "common.h"
#include "T2Equip.h"
#include "T2TenantDef.h"
// is this specific to T2Equip maybe?
enum {
kTenantStatus0 = 0,
kTenantStatus1 = 1,
kTenantStatus2 = 2,
kTenantStatus9 = 9,
kTenantStatus10 = 10,
kTenantStatus30 = 30,
kTenantStatus9999 = 9999,
kTenantStatus10000 = 10000,
// these are used by T2GuestroomTable
kTenantStatus31 = 31,
kTenantStatus32 = 32,
kTenantStatus33 = 33,
kTenantStatus34 = 34,
kTenantStatus35 = 35,
kTenantStatus36 = 36,
kTenantStatus37 = 37,
kTenantStatus38 = 38,
};
enum {
kTenantRegistID1 = 1, // hotel rooms
kTenantRegistID2 = 2, // trash facilities
kTenantRegistID3 = 3, // parking
kTenantRegistID4 = 4, // hospital
kTenantRegistID5 = 5, // security
kTenantRegistID6 = 6, // school
kTenantRegistID7 = 7, // toilets
kTenantRegistID8 = 8, // metro railway
kTenantRegistID9 = 9, // boat deck
kTenantRegistID10 = 10, // ticket booth
};
class AFX_CLASS_EXPORT T2Tenant : public T2Equip {
public:
T2Tenant();
virtual ~T2Tenant();
virtual void SetUsed(BOOL inUsed);
virtual BOOL Enter(CLink* inLink);
virtual BOOL Leave(CLink* inLink);
virtual unsigned int Idle(T2TowerDoc* inDoc);
virtual void Draw(T2TowerDoc* inDoc, const RECT&);
virtual void BuildStart(T2TowerDoc* inDoc);
unsigned int GetResideDay() const { return mResideDay; }
int GetEstimate() const { return mEstimate; }
void SetRelatedTenantID(unsigned int inID) { mRelatedTenantID = inID; }
unsigned int GetRelatedTenantID() const { return mRelatedTenantID; }
BOOL IsSetRelatedTenantID() const { return (mRelatedTenantID != 0); }
BOOL IsFloor() const { return IsSetAttribute(kTenantAttrIsFloor); }
BOOL IsPoolTenant() const { return (mEquipID == 1000); }
BOOL IsHome() const { return IsSetAttribute(kTenantAttrIsHome); }
BOOL IsConcat() const { return IsSetAttribute(kTenantAttrIsConcat); }
BOOL IsPeopleAnime() const { return IsSetAttribute(kTenantAttrIsPeopleAnime | kTenantAttrIsPeopleAnime2); }
BOOL IsNeedToilet() const { return IsSetAttribute(kTenantAttrIsNeedToilet); }
BOOL IsNeedDraw() { return mToolDef && mDrawMode; }
BOOL IsTherePeople() const { return mFirstPeople != NULL; }
BOOL IsThereCustomer() const { return mCustomerCount > 0; }
T2People* GetFirstPeople() const { return mFirstPeople; }
BOOL IsOpen() const { return mStatus >= kTenantStatus30 && mStatus <= kTenantStatus9999; }
BOOL WillBeFull() const { return (mCustomerCount + mReserveCount) >= GetCapacity(); }
int CalcRestCapacity() const { return GetCapacity() - (mCustomerCount + mReserveCount); }
void SetMark(int inMark) { mMark = inMark; }
int GetMark() const { return mMark; }
int GetBelongCount() const { return mBelongCount; }
void ClearWorkCount() { mWorkCount = 0; }
int GetTotalCustomer() const { return mTotalCustomer; }
void ClearTotalCustomer() { mTotalCustomer = 0; }
void IncTotalCustomer() { mTotalCustomer++; }
T2PeoplePtrList* GetBelongList() const { return mBelongList; }
void SetRelatedTenantList(T2EquipPtrList* inList) { mRelatedTenantList = inList; }
T2EquipPtrList* GetRelatedTenantList() const { return mRelatedTenantList; }
virtual BOOL IsBuildFinish() { return mStatus > kTenantStatus9; }
BOOL IsFire() { return mStatus >= kTenantStatus10000; }
BOOL IsFireproof() const { return IsSetAttribute(kTenantAttrIsFireproof); }
unsigned int GetTenantNumber() const { return mTenantNumber; }
void SetTenantNumber(unsigned int inNumber) { mTenantNumber = inNumber; }
virtual PROCCODE DoDestruct(T2TowerDoc* inDoc, POINT inPt, RECT& outRect);
virtual void ClearDrawMode();
virtual void PlaySound(T2TowerDoc* inDoc, int inID, unsigned int inMask, unsigned int inFlags) const;
virtual void AddCEMoverID(const T2FloorInfo* inFloorInfo, POINT inPt, unsigned int inID);
virtual unsigned int GetEntranceFloorID();
virtual unsigned int GetExitFloorID();
unsigned int GetFloorID(int inV);
void SetFloorID(T2FloorInfo* inFloorInfo);
void EnterTenant(T2TowerDoc* inDoc, T2People* inPeople);
void LeaveTenant(T2TowerDoc* inDoc, T2People* inPeople);
BOOL InitTenant(T2TenantDef* inDef, const RECT& inRect, unsigned int inValiation);
POINT GetEntrancePt() const;
POINT GetExitPt();
T2People* GetFirstCustomer() const;
int GetBelongCapacity();
BOOL IsTherePeople(T2People* inPeople);
void StartBuild();
void UpdatePatternIndex();
void UpdatePatternIndex(int inIndex);
int GetNumOfPattern() const;
void CollectCustomer(T2TowerDoc* inDoc, T2Tenant* inTenant);
void CollectCustomer(T2TowerDoc* inDoc, int inNum);
int CollectEmployee(T2TowerDoc* inDoc);
void RegistBelongPeople(T2People* inPeople);
int CalcInMoney() const;
void EnterCustomer(T2People* inPeople, int inBindTime);
BOOL IsBelongPeople(T2People* inPeople) const;
void PushOutPeople(T2TowerDoc* inDoc, T2People* inPeople = NULL);
void PushOutAll(T2TowerDoc* inDoc);
void PushOutAllCustomer(T2TowerDoc* inDoc);
int GetPriceIndex() const;
void RemovePeople(T2TowerDoc* inDoc);
void ClearBelongPeople();
void ClearBelongPeople(T2People* inPeople);
void CallBelongPeople(unsigned int inTime);
T2People* GetBelongPeople(int inIndex);
T2People* GetBelongPeopleIn(int inIndex);
void SetKind();
unsigned int GetRegistID() const;
int GetEmployeeSearchScore() const;
int GetCustomerSearchScore() const;
BOOL IsMoverAvailable() const;
void RemoveBelongList();
BOOL GetQTMovieName(CString str);
void Destruct(T2TowerDoc* inDoc, CRect& outRect);
void SetBindTime(T2People* inPeople, unsigned int inTime);
BOOL SetEstimate(int inEstimate);
BOOL SetPeopleAnime();
void SetPeopleAnime(T2People* inPeople, int inIndex);
void PushOutCustomer(T2TowerDoc* inDoc, int inCount);
BOOL GetBelongPeopleIndex(T2People* inPeople, int& outIndex) const;
BOOL SetPeopleToSleep();
void SetAllPeopleToSleep();
void UnionFloorPeople(T2Tenant* inTenant);
BOOL IsWithinSearchRange(T2TowerDoc* inDoc, T2Tenant* inTenant) const;
void SetMoviePlugin(T2SubPlugin* inPlugin);
void SetHallEventPlugin(T2HallEventPlugin* inPlugin);
int GetFloorNumber(T2FloorInfo* inFloorInfo) const;
int GetRoomNumber(T2FloorInfo* inFloorInfo) const;
void GetRoomName(T2TowerDoc* inDoc, CString& outStr) const;
BOOL IsEmptyParking() const;
T2People* FindPeople(POINT inPt) const;
void IncPeopleEstimate(int inEstimate);
int CalcEstimateColor() const;
BOOL IsRegist() const;
T2TenantMemberTableDef* GetCustomerTableDef(BOOL inFlag) const;
BOOL UpdateResidencialEstimate(T2TowerDoc* inDoc);
void BreakoutEmergency(T2TowerDoc* inTowerDoc);
void BurntDown(T2TowerDoc* inDoc);
void RecoverRelatedTenantList(T2RegistedTenantDB* inDB);
int GetTotalBelong() const;
BOOL CanReplaceWorker() const;
BOOL ReplaceWorker(T2TowerDoc* inDoc, T2People* inPeople);
void CallEmployee(unsigned int inTime);
BOOL DecideResidencialEstimation(T2TowerDoc* inDoc);
BOOL UpdateCommercialEstimate();
int CalcProfitEstimate() const;
void GetMerchandise(int& outCount, int*& outArray);
T2TenantMemberTableDef* GetMerchandiseTMT();
void SetMerchandise(int inCount, int* inArray);
void SetRelatedTenant(T2TowerDoc* inDoc, unsigned int inRegistID);
BOOL IsBind() const;
void Bind();
void Unbind();
unsigned int GetOpenTime() const;
unsigned int GetCloseTime() const;
int GetBindTime() const;
T2TenantMemberTableDef* GetEmployeeTableDef() const;
BOOL IsFull() const;
int GetCustomerCount() const;
int GetKindIndex() const;
void SetKindIndex(int inIndex);
void IncWorkCount();
void DecWorkCount();
int GetWorkCount() const;
void ClearReserveCount();
void IncReserveCount(unsigned int inAmount);
void DecReserveCount();
int GetReserveCount() const;
void CancelReserve();
protected:
virtual void LoadSelf(T2Archive& inArchive, T2TowerDoc* inDoc);
virtual void SaveSelf(T2Archive& inArchive);
virtual void DrawSelf(T2TowerDoc* inDoc, const RECT&);
void AddPopulation(T2People* inPeople);
void SubPopulation(T2People* inPeople);
int CollectCustomerFromPool(T2TowerDoc* inDoc, T2TenantMemberTableDef* inTable, unsigned int inTime, T2Tenant* inTenant);
int CollectCustomerFromTenant(T2TowerDoc* inDoc, T2TenantMemberTableDef* inTable, unsigned int inTime);
int CollectCustomerFromFloor(T2TowerDoc* inDoc, T2TenantMemberTableDef* inTable, unsigned int inTime);
void DuplicateBelongPeople(T2TowerDoc* inDoc);
void RemoveBelongPeople(T2TowerDoc* inDoc);
int GetNumOfKind() const;
BOOL InitBelongList();
void DrawViewModeColor(T2TowerDoc* inDoc) const;
void DrawTrafficColor(T2TowerDoc* inDoc, const CRect&) const;
static void DrawColorMesh(T2TowerDoc* inDoc, const CRect& inRect, int inClr);
BOOL CollectEmployeeFromPool(T2TowerDoc* inDoc, T2TenantMemberTableDef* inTable);
unsigned int CheckRouteFromPool(T2TowerDoc* inDoc, unsigned int inScore) const;
int GetConsumptionPower() const { return 0; }
friend class T2EquipDef;
friend class T2TenantArray;
T2People *mFirstPeople;
T2People *m64;
int mMerchandiseCount;
int mMerchandise[4];
int mResideDay;
int mKindIndex;
int mMark;
BOOL mIsBind;
int mPeopleEstimate;
int mEstimate;
unsigned int mRelatedTenantID;
int mReserveCount;
int mBelongCount;
int mCustomerCount;
int mWorkCount;
int mTotalCustomer;
T2PeoplePtrList *mBelongList;
T2EquipPtrList *mRelatedTenantList;
unsigned int mTenantNumber;
};
inline /*virtual*/ void T2Tenant::ClearDrawMode() {
mDrawMode = DrawMode0;
}
inline BOOL T2Tenant::IsBind() const {
return mIsBind;
}
inline void T2Tenant::Bind() {
mIsBind = true;
}
inline void T2Tenant::Unbind() {
mIsBind = false;
}
inline unsigned int T2Tenant::GetOpenTime() const {
unsigned int time = 0;
T2TenantDef *def = (T2TenantDef *) mToolDef;
if (def)
time = def->mOpenTime;
return time;
}
inline unsigned int T2Tenant::GetCloseTime() const {
unsigned int time = 0;
T2TenantDef *def = (T2TenantDef *) mToolDef;
if (def)
time = def->mCloseTime;
return time;
}
inline int T2Tenant::GetBindTime() const {
int time = 0;
T2TenantDef *def = (T2TenantDef *) mToolDef;
if (def)
time = def->mBindTime;
return time;
}
inline T2TenantMemberTableDef* T2Tenant::GetEmployeeTableDef() const {
T2TenantMemberTableDef *theDef = NULL;
if (mToolDef)
theDef = ((T2TenantDef *) mToolDef)->mEmployeeTableDef;
return theDef;
}
inline BOOL T2Tenant::IsFull() const {
return mCustomerCount >= GetCapacity();
}
inline int T2Tenant::GetCustomerCount() const {
return mCustomerCount;
}
inline int T2Tenant::GetKindIndex() const {
return mKindIndex;
}
inline void T2Tenant::SetKindIndex(int inIndex) {
mKindIndex = inIndex;
}
inline void T2Tenant::IncWorkCount() {
mWorkCount++;
}
inline void T2Tenant::DecWorkCount() {
mWorkCount--;
}
inline int T2Tenant::GetWorkCount() const {
return mWorkCount;
}
inline void T2Tenant::ClearReserveCount() {
mReserveCount = 0;
}
inline void T2Tenant::IncReserveCount(unsigned int inAmount) {
mReserveCount += inAmount;
}
inline void T2Tenant::DecReserveCount() {
if (mReserveCount > 0)
mReserveCount--;
}
inline int T2Tenant::GetReserveCount() const {
return mReserveCount;
}
inline void T2Tenant::CancelReserve() {
if (mReserveCount > 0)
mReserveCount--;
}
|