#ifndef T2DLL_T2MOVER_H #define T2DLL_T2MOVER_H #include "../common.h" #include "T2Equip.h" enum { kMoverStatus0 = 0, kMoverStatus9 = 9 }; class AFX_CLASS_EXPORT T2Mover : public T2Equip { public: T2Mover(); virtual ~T2Mover(); void SetShowShaft(BOOL v) { mShowShaft = v; } void StartBuild() { mStatus = kMoverStatus0; } virtual BOOL IsBuildFinish() { return mStatus >= kMoverStatus9; } virtual void SetUsed(BOOL); virtual BOOL Enter(CLink*) { return false; } virtual BOOL Leave(CLink*) { return false; } virtual unsigned int Idle(T2TowerDoc*); virtual void Draw(T2TowerDoc*, const RECT&); virtual PROCCODE DoDestruct(T2TowerDoc*, POINT, RECT&); virtual BOOL Destruct(T2TowerDoc*, CRect&); virtual T2InfoDialog* ShowInfoDialog(T2TowerDoc*, CPoint); BOOL InitMover(T2MoverDef* moverDef, const RECT& baseRect, unsigned int valiation); BOOL InitStair(T2MoverDef* moverDef, const RECT& baseRect, unsigned int valiation); BOOL InitElevator(T2MoverDef* moverDef, const RECT& baseRect, unsigned int valiation); void GetTypicalName(CString&) const; int GetNumStop() const; void AddStopBoth(T2TowerDoc* towerDoc, int position); BOOL AddStop(T2FloorInfo* floorInfo, int position, ERequestUpDown upDown); void RemoveStopBoth(T2TowerDoc* towerDoc, int position); void RemoveStop(T2TowerDoc* towerDoc, int position, ERequestUpDown upDown); void RemoveCrossEquipID(T2FloorInfo* floorInfo, int position); void RemoveUnstoppable(T2TowerDoc* towerDoc); void AddCrossEquipID(T2FloorInfo* floorInfo, int position); void AddCEFloorID(T2FloorInfo* floorInfo, int position); void ReplaceID(T2FloorInfo* floorInfo, unsigned int); POINT PositionToStopPt(int position, ERequestUpDown upDown); int UnitToPosition(int unit) const; int PositionToUnit(int position) const; BOOL IsStopPosition(int position) const; BOOL IsStopPosition(int position, ERequestUpDown upDown); BOOL AddModule(T2TowerDoc* towerDoc, int position); void AddStairModule(T2TowerDoc* towerDoc, const RECT& rect, BOOL insertAtEnd); unsigned int GetRequestID(int position, BOOL isDown) const; int GetModuleCount() const; int FindStairModule(T2TowerDoc*, POINT, T2MoverModule*&, T2MoverModule*&); int CalcModuleRect(const T2MoverModule*, RECT&, int&) const; T2MoverModule* FindPeople(const T2People*) const; void CalcMachineArea(EEquipPos, RECT&) const; void AdjustLength(); T2Request* GetRequest(T2FloorInfo* floorInfo, int position, BOOL isDown) const; int CalcScore(int) const; int ExpandArea(T2TowerDoc* inDoc, EEquipPos inEquipPos, int inCount); BOOL IsHomePosition(int) const; void CalcBodyArea(RECT&) const; int CalcModulePos(T2MoverModule*, ERequestUpDown); void ShowShaft(); void HideShaft(); BOOL IsStair() const; BOOL IsElevator() const; BOOL IsCheckRequest() const; void SetCheckRequest(BOOL v); int GetLength() const; int GetWaitCount() const; T2RequestIDArray* GetReqIDArray() const; T2MoverModuleList* GetModuleList() const; BOOL IsShaftVisible() const; protected: virtual void LoadSelf(T2Archive&, T2TowerDoc*); virtual void SaveSelf(T2Archive&); friend class T2MoverDef; int mLength; T2RequestIDArray *mReqIDArray; int mWaitCount; int mMaxModule; T2MoverModuleList *mModuleList; BOOL mShowShaft; BOOL mCheckRequest; }; inline BOOL T2Mover::IsStair() const { return IsSetAttribute(kMoverAttrIsStair); } inline BOOL T2Mover::IsElevator() const { return IsSetAttribute(kMoverAttrIsElevator); } inline BOOL T2Mover::IsCheckRequest() const { return mCheckRequest; } inline void T2Mover::SetCheckRequest(BOOL v) { mCheckRequest = v; } inline int T2Mover::GetLength() const { return mLength; } inline int T2Mover::GetWaitCount() const { return mWaitCount; } inline T2RequestIDArray* T2Mover::GetReqIDArray() const { return mReqIDArray; } inline T2MoverModuleList* T2Mover::GetModuleList() const { return mModuleList; } inline BOOL T2Mover::IsShaftVisible() const { return mShowShaft; } #endif