From c0c336500955a23e344651e5412c9d9d441ef4ee Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 28 Jun 2023 22:22:32 +0100 Subject: first pass of T2DLL --- src/T2DLL/T2ElevatorModule.h | 105 +++++++++++++++++++++++++++---------------- 1 file changed, 67 insertions(+), 38 deletions(-) (limited to 'src/T2DLL/T2ElevatorModule.h') diff --git a/src/T2DLL/T2ElevatorModule.h b/src/T2DLL/T2ElevatorModule.h index 66438d9..78b737d 100644 --- a/src/T2DLL/T2ElevatorModule.h +++ b/src/T2DLL/T2ElevatorModule.h @@ -1,29 +1,43 @@ #pragma once #include "common.h" +#include "T2MoverModule.h" -class T2ElevatorModule { +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); + T2ElevatorModule(int index); virtual ~T2ElevatorModule(); - void Init(int, int); - virtual void SetUsed(int); - int IsPtInArea(POINT, const RECT&) const; - virtual void StopAdded(T2TowerDoc*, T2Mover*, int); - virtual void StopRemoved(T2TowerDoc*, T2Mover*, int); + 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*); -protected: - void RemoveContents(T2TowerDoc*, T2Mover*, int); - int HomePosRemoved(T2Mover*, int); - void TopTurnPosRemoved(int); - void BottomTurnPosRemoved(int); - void NextStopRemoved(); -public: void MoverExpanded(T2Mover*, EEquipPos, int); - int IsStopPos(int, ERequestUpDown) const; - int IsOnStopPos(int, ERequestUpDown) const; - int IsOffStopPos(int, ERequestUpDown) const; - void SetOnStop(int, ERequestUpDown); - void SetOffStop(int, ERequestUpDown); + 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(); @@ -32,26 +46,41 @@ public: 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; -public: - int IsPatChanged(T2Mover*); - T2People* LeaveToDstFloor(int); - virtual void Enter(T2Mover*, T2People*); -protected: - virtual void LoadSelf(T2Archive&, T2TowerDoc*); - virtual void SaveSelf(T2Archive&); -public: - int GetIndex() const {} - void SetHomePosition(int) {} - int GetOffsetPos() {} - void SetOffsetPos(int) {} - void AddOffsetPos(int) {} - int GetNextStop() const {} - int GetTopTurn() const {} - int GetBottomTurn() const {} - T2ElevatorModule(const T2ElevatorModule&) {} - T2ElevatorModule& operator=(const T2ElevatorModule&) {} - int GetHomePosition() const {} + int mIndex; + int mHomePosition; + int mOffsetPos; + int mNextStop; + int mRequestCount; + int mTopTurn; + int mBottomTurn; + T2StopInfoArray *mStopInfoArray; }; -- cgit v1.2.3