diff options
Diffstat (limited to 'src/T2DLL/T2Tenant.h')
-rw-r--r-- | src/T2DLL/T2Tenant.h | 386 |
1 files changed, 228 insertions, 158 deletions
diff --git a/src/T2DLL/T2Tenant.h b/src/T2DLL/T2Tenant.h index fd2a6fa..73dd7f5 100644 --- a/src/T2DLL/T2Tenant.h +++ b/src/T2DLL/T2Tenant.h @@ -1,188 +1,258 @@ #pragma once #include "common.h" +#include "T2Equip.h" +#include "T2TenantDef.h" -class T2Tenant { +// 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 T2Tenant : public T2Equip { public: T2Tenant(); virtual ~T2Tenant(); - unsigned int GetFloorID(int); - void SetFloorID(T2FloorInfo*); - virtual PROCCODE DoDestruct(T2TowerDoc*, POINT, RECT&); -protected: - void AddPopulation(T2People*); - void SubPopulation(T2People*); -public: - virtual int Enter(CLink*); - virtual int Leave(CLink*); - void EnterTenant(T2TowerDoc*, T2People*); - void LeaveTenant(T2TowerDoc*, T2People*); - virtual void Draw(T2TowerDoc*, const RECT&); -protected: - virtual void DrawSelf(T2TowerDoc*, const RECT&); -public: - virtual unsigned int Idle(T2TowerDoc*); - virtual void AddCEMoverID(const T2FloorInfo*, POINT, unsigned int); - int InitTenant(T2TenantDef*, const RECT&, unsigned int); -protected: - virtual void LoadSelf(T2Archive&, T2TowerDoc*); - virtual void SaveSelf(T2Archive&); -public: + 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); + virtual BOOL IsBuildFinish() { return mStatus > kTenantStatus9; } + virtual PROCCODE DoDestruct(T2TowerDoc* inDoc, POINT inPt, RECT& outRect); + virtual void ClearDrawMode() { mDrawMode = DrawMode0; } + 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(); - POINT GetEntrancePt() const; 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(); - int IsTherePeople(T2People*); + BOOL IsTherePeople(T2People* inPeople); void StartBuild(); void UpdatePatternIndex(); - void UpdatePatternIndex(int); + void UpdatePatternIndex(int inIndex); int GetNumOfPattern() const; -protected: - int CollectCustomerFromPool(T2TowerDoc*, T2TenantMemberTableDef*, unsigned int, T2Tenant*); - int CollectCustomerFromTenant(T2TowerDoc*, T2TenantMemberTableDef*, unsigned int); - int CollectCustomerFromFloor(T2TowerDoc*, T2TenantMemberTableDef*, unsigned int); -public: - void CollectCustomer(T2TowerDoc*, T2Tenant*); - void CollectCustomer(T2TowerDoc*, int); - int CollectEmployee(T2TowerDoc*); - void RegistBelongPeople(T2People*); + 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*, int); - int IsBelongPeople(T2People*) const; - void PushOutPeople(T2TowerDoc*, T2People*); - void PushOutAll(T2TowerDoc*); - void PushOutAllCustomer(T2TowerDoc*); + 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; -protected: - void DuplicateBelongPeople(T2TowerDoc*); - void RemoveBelongPeople(T2TowerDoc*); -public: - void RemovePeople(T2TowerDoc*); + void RemovePeople(T2TowerDoc* inDoc); void ClearBelongPeople(); - void ClearBelongPeople(T2People*); - void CallBelongPeople(unsigned int); - T2People* GetBelongPeople(int); - T2People* GetBelongPeopleIn(int); + void ClearBelongPeople(T2People* inPeople); + void CallBelongPeople(unsigned int inTime); + T2People* GetBelongPeople(int inIndex); + T2People* GetBelongPeopleIn(int inIndex); void SetKind(); -protected: - int GetNumOfKind() const; -public: - virtual void SetUsed(int); unsigned int GetRegistID() const; int GetEmployeeSearchScore() const; int GetCustomerSearchScore() const; - int IsMoverAvailable() const; + BOOL IsMoverAvailable() const; void RemoveBelongList(); - int GetQTMovieName(CString); - void Destruct(T2TowerDoc*, CRect&); - void SetBindTime(T2People*, unsigned int); - int SetEstimate(int); - int SetPeopleAnime(); - void SetPeopleAnime(T2People*, int); - void PushOutCustomer(T2TowerDoc*, int); - int GetBelongPeopleIndex(T2People*, int&) const; - int SetPeopleToSleep(); + 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*); - int IsWithinSearchRange(T2TowerDoc*, T2Tenant*) const; - void SetMoviePlugin(T2SubPlugin*); - void SetHallEventPlugin(T2HallEventPlugin*); - int GetFloorNumber(T2FloorInfo*) const; - int GetRoomNumber(T2FloorInfo*) const; - void GetRoomName(T2TowerDoc*, CString&) const; - virtual void PlaySoundA(T2TowerDoc*, int, unsigned int, unsigned int) const; - int IsEmptyParking() const; - T2People* FindPeople(POINT) const; -protected: - int InitBelongList(); - void DrawViewModeColor(T2TowerDoc*) const; - void DrawTrafficColor(T2TowerDoc*, const CRect&) const; - static void DrawColorMesh(T2TowerDoc*, const CRect&, int); -public: - void IncPeopleEstimate(int); + 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; -protected: - int CollectEmployeeFromPool(T2TowerDoc*, T2TenantMemberTableDef*); -public: - int IsRegist() const; -protected: - unsigned int CheckRouteFromPool(T2TowerDoc*, unsigned int) const; -public: - T2TenantMemberTableDef* GetCustomerTableDef(int) const; - int UpdateResidencialEstimate(T2TowerDoc*); - void BreakoutEmergency(T2TowerDoc*); - void BurntDown(T2TowerDoc*); - void RecoverRelatedTenantList(T2RegistedTenantDB*); + BOOL IsRegist() const; + T2TenantMemberTableDef* GetCustomerTableDef(BOOL inFlag) const; + BOOL UpdateResidencialEstimate(T2TowerDoc* inDoc); + void BreakoutEmergency(T2TowerDoc* inDoc); + void BurntDown(T2TowerDoc* inDoc); + void RecoverRelatedTenantList(T2RegistedTenantDB* inDB); int GetTotalBelong() const; - int CanReplaceWorker() const; - int ReplaceWorker(T2TowerDoc*, T2People*); - void CallEmployee(unsigned int); - int DecideResidencialEstimation(T2TowerDoc*); - int UpdateCommercialEstimate(); + 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&, int*&); + void GetMerchandise(int& outCount, int*& outArray); T2TenantMemberTableDef* GetMerchandiseTMT(); - void SetMerchandise(int, int*); - void SetRelatedTenant(T2TowerDoc*, unsigned int); - virtual void BuildStart(T2TowerDoc*); + void SetMerchandise(int inCount, int* inArray); + void SetRelatedTenant(T2TowerDoc* inDoc, unsigned int inRegistID); + + 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; } + BOOL IsFire() { return mStatus >= kTenantStatus10000; } + BOOL IsFireproof() const { return IsSetAttribute(kTenantAttrIsFireproof); } + unsigned int GetTenantNumber() const { return mTenantNumber; } + void SetTenantNumber(unsigned int inNumber) { mTenantNumber = inNumber; } + BOOL IsBind() const { return mIsBind; } + void Bind() { mIsBind = true; } + void Unbind() { mIsBind = false; } + unsigned int GetOpenTime() const { + unsigned int time = 0; + T2TenantDef *def = (T2TenantDef *) mToolDef; + if (def) + time = def->mOpenTime; + return time; + } + unsigned int GetCloseTime() const { + unsigned int time = 0; + T2TenantDef *def = (T2TenantDef *) mToolDef; + if (def) + time = def->mCloseTime; + return time; + } + int GetBindTime() const { + int time = 0; + T2TenantDef *def = (T2TenantDef *) mToolDef; + if (def) + time = def->mBindTime; + return time; + } + T2TenantMemberTableDef* GetEmployeeTableDef() const { + T2TenantMemberTableDef *theDef = NULL; + if (mToolDef) + theDef = ((T2TenantDef *) mToolDef)->mEmployeeTableDef; + return theDef; + } + BOOL IsFull() const { return mCustomerCount > GetCapacity(); } + int GetCustomerCount() const { return mCustomerCount; } + int GetKindIndex() const { return mKindIndex; } + void SetKindIndex(int inIndex) { mKindIndex = inIndex; } + void IncWorkCount() { mWorkCount++; } + void DecWorkCount() { mWorkCount--; } + int GetWorkCount() const { return mWorkCount; } + void ClearReserveCount() { mReserveCount = 0; } + void IncReserveCount(unsigned int inAmount) { mReserveCount += inAmount; } + void DecReserveCount() { + if (mReserveCount > 0) + mReserveCount--; + } + int GetReserveCount() const { return mReserveCount; } + void CancelReserve() { + if (mReserveCount > 0) + mReserveCount--; + } - unsigned int GetResideDay() const {} - int GetEstimate() const {} - void SetRelatedTenantID(unsigned int) {} - unsigned int GetRelatedTenantID() const {} - int IsSetRelatedTenantID() const {} - int IsFloor() const {} - int IsPoolTenant() const {} - int IsHome() const {} - int IsConcat() const {} - int IsPeopleAnime() const {} - int IsNeedToilet() const {} - int IsNeedDraw() {} - int IsTherePeople() const {} - int IsThereCustomer() const {} - T2People* GetFirstPeople() const {} - int IsOpen() const {} - int WillBeFull() const {} - int CalcRestCapacity() const {} - void SetMark(int) {} - int GetMark() const {} - int GetBelongCount() const {} - void ClearWorkCount() {} - int GetTotalCustomer() const {} - void ClearTotalCustomer() {} - void IncTotalCustomer() {} - T2PeoplePtrList* GetBelongList() const {} - void SetRelatedTenantList(T2EquipPtrList*) {} - T2EquipPtrList* GetRelatedTenantList() const {} - virtual int IsBuildFinish() {} - int IsFire() {} - int IsFireproof() const {} - unsigned int GetTenantNumber() const {} - void SetTenantNumber(unsigned int) {} protected: - int GetConsumptionPower() const {} -public: - T2Tenant(const T2Tenant&) {} - T2Tenant& operator=(const T2Tenant&) {} - virtual void ClearDrawMode() {} - int IsBind() const {} - void Bind() {} - void Unbind() {} - unsigned int GetOpenTime() const {} - unsigned int GetCloseTime() const {} - int GetBindTime() const {} - T2TenantMemberTableDef* GetEmployeeTableDef() const {} - int IsFull() const {} - int GetCustomerCount() const {} - int GetKindIndex() const {} - void SetKindIndex(int) {} - void IncWorkCount() {} - void DecWorkCount() {} - int GetWorkCount() const {} - void ClearReserveCount() {} - void IncReserveCount(unsigned int) {} - void DecReserveCount() {} - int GetReserveCount() const {} - void CancelReserve() {} + 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; }; |