summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2PeopleType.h
blob: 25d980e20b105b8ee2beec70732d243e78f18242 (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
125
126
127
128
129
130
131
132
#ifndef T2DLL_T2PEOPLETYPE_H
#define T2DLL_T2PEOPLETYPE_H
#include "../common.h"

// Transport types
enum {
    kTransportLobbyLeft = 0,
    kTransportLobbyRight,
    kTransportParking,
    kTransportSubway,
    kTransportShip
};

enum {
    kTransportFlagLobbyLeft = 1 << kTransportLobbyLeft,
    kTransportFlagLobbyRight = 1 << kTransportLobbyRight,
    kTransportFlagParking = 1 << kTransportParking,
    kTransportFlagSubway = 1 << kTransportSubway,
    kTransportFlagShip = 1 << kTransportShip
};

enum {
    kEconoType7 = 7,
};

enum {
    kMaxTimeZone = 24,
};

enum {
    kDemandType0 = 0,
    kDemandType1 = 1,
    kDemandType2 = 2,
    kDemandType3 = 3, // tourist?
    kDemandType4 = 4,
    kDemandType5 = 5,
    kDemandType6 = 6,
    kDemandType7 = 7,
    kMaxDemand = 8,
};

class AFX_CLASS_EXPORT T2PeopleType {
public:
	T2PeopleType();
	~T2PeopleType();
	void SetDemandType(int);
	void SetTimeZoneType(int);
	int GetDemandType() const;
	int GetTimeZoneType() const;
	void RecoverLife();
	void Duplicate(T2PeopleType&) const;
	BOOL Check(T2TenantMemberDef*, int inEconoType, unsigned int inRoute) const;
	BOOL CheckWithDemand(T2TenantMemberDef*, int econoType) const;
	void Read(T2Archive&);
	void Write(T2Archive&);

	void SetSilhouetteType(int v);
	void SetEconoType(int v);
	void SetTransportType(int v);
	void SetLifeCount(int v);
	int GetSilhouetteType() const;
	int GetTransportType() const;
	int GetAge() const;
	BOOL IsMale() const;
	BOOL IsImmortal() const;
	BOOL HasLife() const;
	void DecreaseLife();
	int GetEconoType() const;

protected:
	BOOL CheckDemandType(int) const;
	BOOL CheckSilhouetteType(T2TenantMemberDef*) const;
	BOOL CheckSilhouetteOptionType(int) const;

	unsigned int mAttribute;
	int mSilhouetteType;
	int mEconoType;
	int mLife;
	int mTransportType;

	friend class T2PoolView;
};

inline void T2PeopleType::SetSilhouetteType(int v) {
    mSilhouetteType = v;
}

inline void T2PeopleType::SetEconoType(int v) {
    mEconoType = v;
}

inline void T2PeopleType::SetTransportType(int v) {
    mTransportType = v;
}

inline void T2PeopleType::SetLifeCount(int v) {
    mLife = v;
}

inline int T2PeopleType::GetSilhouetteType() const {
    return mSilhouetteType;
}

inline int T2PeopleType::GetTransportType() const {
    return mTransportType;
}

inline int T2PeopleType::GetAge() const {
    return mSilhouetteType >> 3;
}

inline BOOL T2PeopleType::IsMale() const {
    return (mSilhouetteType % 2) == 0;
}

inline BOOL T2PeopleType::IsImmortal() const {
    return (mLife == 127);
}

inline BOOL T2PeopleType::HasLife() const {
    return (mLife > 0);
}

inline void T2PeopleType::DecreaseLife() {
    if (!IsImmortal())
        mLife--;
}

inline int T2PeopleType::GetEconoType() const {
    return mEconoType;
}
#endif