summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2FloorInfo.h
blob: bcb61655b4c610959289c06db84e87f02d2bf02c (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
#pragma once
#include "common.h"

class AFX_CLASS_EXPORT T2FloorInfo {
public:
	T2FloorInfo(const T2WorldDef* inWorldDef);
	virtual ~T2FloorInfo();
	int UnitToFloor(int unit) const;
	void InitMask(CResFile& inResFile);
	void Read(T2Archive& inArchive, T2TowerDoc* inDoc);
	void Write(T2Archive& inArchive);
	BOOL IsAreaBuildable(const RECT& inRect);
	BOOL IsAllTenant(const RECT& inRect);
	BOOL IsThereNoFloorTenant(const RECT& inRect);
	BOOL IsThereMover(const RECT& inRect);
	BOOL IsThereOtherKindMover(const RECT& inRect, int inType);
	BOOL IsEnoughSideSpace(const RECT& inRect);
	T2Tenant* GetTenant(unsigned int inTenantID) const;
	T2Tenant* GetTenant(int inV, int inH) const;
	T2Tenant* GetPoolTenant() const;
	T2Tenant* GetFloor(int inV, int inH) const;
	T2Mover* GetMover(unsigned int inMoverID);
	T2Mover* GetMover(int inV, int inH);
	T2MoverModule* GetModule(unsigned int inModuleID) const;
	T2Request* GetRequest(unsigned int inRequestID) const;
	T2Request* GetRequest(int inV, int inH) const;
	T2People* FindPeople(int inV, int inH) const;
	T2OutObj* GetOutObj(int inV, int inH) const;
	T2OutObj* GetIndOutObj(unsigned int inIndex) const;
	T2Tenant* FindUnusedTenant();
	T2Mover* FindUnusedMover();
	T2Request* FindUnusedRequest();
	T2OutObj* FindUnusedOutObj();
	unsigned int GetTenantID(int inV, int inH) const;
	unsigned int GetFloorID(int inV, int inH);
	unsigned int GetEntranceFloorID(unsigned int inTenantID);
	POINT GetEntrancePt(unsigned int inTenantID);
	unsigned int GetMoverID(int inV, int inH);
	unsigned int GetRequestID(int inV, int inH) const;
	unsigned int GetOutObjID(int inV, int inH) const;
	T2UnitInfo* GetUnitInfo(int inV, int inH) const;
	void FillTenantID(const RECT& inRect, unsigned int inTenantID);
	void ReplaceFloorID(const RECT& inRect, unsigned int inOldID, unsigned int inNewID);
	void FillMoverID(const RECT& inRect, unsigned int inMoverID);
	void FillRequestID(const RECT& inRect, unsigned int inRequestID);
	int FillRequestID(POINT inPt, ERequestUpDown inUpDown, unsigned int inRequestID);
	void RemoveRequestID(ERequestUpDown inUpDown, const RECT& inRect);
	void FillOutObjID(const RECT& inRect, unsigned int inOutObjID);
	unsigned int FindTenantID(int inV, int inH, BOOL inRight, int inMaxDistance, unsigned int inExclTenantID);
	int GetLeftMoverID(POINT inPt, int inMinH) const;
	void UpdeteRequestByUnionFloor(T2Tenant* inTenant, POINT inPt);
	void MoverAreaAdded(const RECT& inRect, unsigned int inMoverID);
	void MoverAreaRemoved(const RECT& inRect);
	void UpdeteRequestByBuildMover(const RECT& inRect);
	void UpdeteRequestByRemoveMover(const RECT& inRect);
	unsigned int GetNextTenantNumber(int inV);
	void SetTenantNumber(int inV, unsigned int inTenantNumber);
	T2Tenant* FindNumberredTenant(int inV, unsigned int inTenantNumber);
	void FinishBuildFloor(T2TowerDoc* inDoc, const RECT& inRect);
	void SetTenantDrawModeByRect(const RECT& inRect, int inDrawMode);
	void UpdateFloorCEArray(const RECT& inRect, unsigned int inOldID, unsigned int inNewID);
	int CalcMentenanceCost(T2TowerDoc* inDoc) const;
	T2Tenant* GetTenantByPID(DWORD inPluginID);
	BOOL BuildFinishForce(const RECT& inRect);

	int GetVRange() const;
	int GetHRange() const;
	int GetGroundLine() const;
	int GetTopFloorLine() const;
	int GetBottomFloorLine() const;
	int GetEntranceWidth() const;
	void GetBuildArea(RECT& outRect) const;
	void GetFloorArea(RECT& outRect) const;
	T2TenantArrayList* GetTenantArrayList() const;
	T2MoverArrayList* GetMoverArrayList() const;
	T2RequestArrayList* GetRequestArrayList() const;
	T2OutObjArrayList* GetOutObjArrayList() const;
	T2OutsideInfo* GetOutsideInfo() const;

	int mVRange;
	int mHRange;
	int mGroundLine;
	int mTopFloorLine;
	int mBottomFloorLine;
	int mEntranceWidth;
	RECT mBuildArea;
	RECT mFloorArea;
	T2UnitInfo *mUnitInfo;
	unsigned int *mTenantNumber;
	T2TenantArrayList *mTenantArrayList;
	T2MoverArrayList *mMoverArrayList;
	T2RequestArrayList *mRequestArrayList;
	T2OutObjArrayList *mOutObjArrayList;
	T2OutsideInfo *mOutsideInfo;

protected:
	BOOL IsValidRange(const RECT& inRect) const;
	int CalcRequestRightEnd(POINT inPt, int inMaxH);
	int CalcRequestLeftEnd(POINT inPt, int inMinH);
};

inline int T2FloorInfo::GetVRange() const { return mVRange; }
inline int T2FloorInfo::GetHRange() const { return mHRange; }
inline int T2FloorInfo::GetGroundLine() const { return mGroundLine; }
inline int T2FloorInfo::GetTopFloorLine() const { return mTopFloorLine; }
inline int T2FloorInfo::GetBottomFloorLine() const { return mBottomFloorLine; }
inline int T2FloorInfo::GetEntranceWidth() const { return mEntranceWidth; }
inline void T2FloorInfo::GetBuildArea(RECT& outRect) const { outRect = mBuildArea; }
inline void T2FloorInfo::GetFloorArea(RECT& outRect) const { outRect = mFloorArea; }
inline T2TenantArrayList* T2FloorInfo::GetTenantArrayList() const { return mTenantArrayList; }
inline T2MoverArrayList* T2FloorInfo::GetMoverArrayList() const { return mMoverArrayList; }
inline T2RequestArrayList* T2FloorInfo::GetRequestArrayList() const { return mRequestArrayList; }
inline T2OutObjArrayList* T2FloorInfo::GetOutObjArrayList() const { return mOutObjArrayList; }
inline T2OutsideInfo* T2FloorInfo::GetOutsideInfo() const { return mOutsideInfo; }