#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, // means it's opening tomorrow kTenantStatus11 = 11, kTenantStatus12 = 12, kTenantStatus13 = 13, kTenantStatus14 = 14, kTenantStatus15 = 15, 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 { // hotel rooms kTenantRegistID1 = 1, // trash facilities kTenantRegistID2 = 2, // parking kTenantRegistID3 = 3, // hospital kTenantRegistID4 = 4, // security kTenantRegistID5 = 5, // school kTenantRegistID6 = 6, // toilets kTenantRegistID7 = 7, // metro railway kTenantRegistID8 = 8, // boat deck kTenantRegistID9 = 9, // ticket booth kTenantRegistID10 = 10, }; 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 = NULL); 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--; }