summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2Mover.h
blob: 606ea0945b7d8de9875ba5f37034465baa0c53a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#pragma once
#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;
}