#pragma once #include "common.h" #include "T2MoverModule.h" enum { kElevatorStatus0 = 0, kElevatorStatus1, kElevatorStatus2, kElevatorStatus3, kElevatorStatus4, kElevatorStatus5, }; enum { // no direction set kElevatorDirection0 = 0, // moving up kElevatorDirection1, // moving down kElevatorDirection2 }; class AFX_EXT_CLASS T2ElevatorModule : public T2MoverModule { public: T2ElevatorModule(int index); virtual ~T2ElevatorModule(); virtual void SetUsed(BOOL used); virtual void Enter(T2Mover*, T2People*); virtual void StopAdded(T2TowerDoc*, T2Mover*, int); virtual void StopRemoved(T2TowerDoc*, T2Mover*, int); void Init(int count, int position); BOOL IsPtInArea(POINT, const RECT&) const; void Remove(T2TowerDoc*, T2Mover*); void MoverExpanded(T2Mover*, EEquipPos, int); BOOL IsStopPos(int position, ERequestUpDown upDown) const; BOOL IsOnStopPos(int position, ERequestUpDown upDown) const; BOOL IsOffStopPos(int position, ERequestUpDown upDown) const; void SetOnStop(int position, ERequestUpDown upDown); void SetOffStop(int position, ERequestUpDown upDown); void ClearOnStop(T2Request*); void ClearOffStop(T2Request*); void SetNextStop(); void ChangeTurnPos(); void StartToHomePos(); T2Request* GetAppointRequest(T2FloorInfo*, T2Mover*); T2Request* GetAnyRequest(T2FloorInfo*, T2Mover*); void CalcUintArea(const T2Mover*, RECT&) const; BOOL IsPatChanged(T2Mover*); T2People* LeaveToDstFloor(int y); int GetIndex() const { return mIndex; } void SetHomePosition(int v) { mHomePosition = v; } int GetOffsetPos() { return mOffsetPos; } void SetOffsetPos(int v) { mOffsetPos = v; } void AddOffsetPos(int v) { mOffsetPos += v; } int GetNextStop() const { return mNextStop; } int GetTopTurn() const { return mTopTurn; } int GetBottomTurn() const { return mBottomTurn; } int GetHomePosition() const { int result = -1; if (mUsed) result = mHomePosition; return result; } protected: virtual void LoadSelf(T2Archive&, T2TowerDoc*); virtual void SaveSelf(T2Archive&); void RemoveContents(T2TowerDoc*, T2Mover*, int); BOOL HomePosRemoved(T2Mover*, int); void TopTurnPosRemoved(int); void BottomTurnPosRemoved(int); void NextStopRemoved(); void CalcUintArea(const T2Mover*, int, RECT&) const; int mIndex; int mHomePosition; int mOffsetPos; int mNextStop; int mRequestCount; int mTopTurn; int mBottomTurn; T2StopInfoArray *mStopInfoArray; };