-
Notifications
You must be signed in to change notification settings - Fork 0
/
clubs.h
103 lines (100 loc) · 3.58 KB
/
clubs.h
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
#ifndef CLUBS_H
#define CLUBS_H
#include <QString>
#include <QList>
#include "person.h"
#include "json_macros.h"
#include "statchange.h"
#include "bodysizechange.h"
#include "timedata.h"
class ClubLevel {
public:
ClubLevel(QJsonObject *d = NULL):
ImportantStat("Happiness"),
ClubRoom("Normal School"),
StartTime(16),
EndTime(16)
{
if (d) init(d);
}
void init(QJsonObject *d)
{
for (QJsonObject::iterator it = d->begin(); it != d->end(); ++it) {
__IF_VAR_FROM_JSON_AS(it, Name, toString)
else __IF_VAR_FROM_JSON_AS(it, intEditorName, toString)
else __IF_VAR_FROM_JSON_AS(it, ImportantStat, toString)
else __IF_VAR_FROM_JSON_AS(it, ImportantStatInverted, toBool)
else __IF_VAR_FROM_JSON_AS(it, CorruptionLevel, toInt)
else __IF_VAR_FROM_JSON_AS(it, WeeklyAccount, toDouble)
else __IF_VAR_FROM_JSON_AS(it, Description, toString)
else __IF_VAR_FROM_JSON_AS(it, ImagePath, toString)
else __IF_VAR_FROM_JSON_AS(it, ClubRoom, toString)
else __IF_LIST_FROM_JSON_TYPED(it, ForGender, toString)
else __IF_LIST_FROM_JSON_TYPED(it, ClubEventDirectories, toString)
else __IF_LIST_FROM_JSON_TYPED(it, ClubEventIDs, toInt)
else __IF_EASY_OBJLIST_FROM_JSON(it, StatChange)
else __IF_EASY_OBJLIST_FROM_JSON(it, BodySizeChange)
else __IF_OBJ_FROM_JSON(it, StartTime)
else __IF_OBJ_FROM_JSON(it, EndTime)
else qWarning(it.key().append(": unhandled.").toUtf8());
}
}
QString Name;
QString intEditorName;
QList<QString> ForGender;
QString ImportantStat;
bool ImportantStatInverted;
int CorruptionLevel;
double WeeklyAccount;
QString Description;
QString ImagePath;
QString ClubRoom;
TimeData StartTime;
TimeData EndTime;
QList<QString> ClubEventDirectories;
QList<uint> ClubEventIDs;
QList<StatChange> StatChanges;
QList<BodySizeChange> BodySizeChanges;
};
class Clubs {
public:
Clubs(QJsonObject *d = NULL):
AutomaticJoiningEnabled(true),
HideFromManagementPanel(false)
{
if (d) init(d);
}
void init(QJsonObject *d)
//QList<Person> UnassignedStudents;,
{
for (QJsonObject::iterator it = d->begin(); it != d->end(); ++it) {
__IF_VAR_FROM_JSON_AS(it, Name, toString)
else __IF_VAR_FROM_JSON_AS(it, MaxClubSize, toInt)
else __IF_VAR_FROM_JSON_AS(it, MemberCount, toInt)
else __IF_VAR_FROM_JSON_AS(it, DesiredCount, toInt)
else __IF_VAR_FROM_JSON_AS(it, currentClubLevelIndex, toInt)
else __IF_VAR_FROM_JSON_AS(it, AutomaticJoiningEnabled, toBool)
else __IF_VAR_FROM_JSON_AS(it, HideFromManagementPanel, toBool)
else __IF_VAR_FROM_JSON_AS(it, Active, toBool)
else __IF_VAR_FROM_JSON_AS(it, CanBeChosen, toBool)
else __IF_VAR_FROM_JSON_AS(it, ClubPresident, toString)
else __IF_VAR_FROM_JSON_AS(it, PreferredPresident, toString)
else __IF_EASY_OBJLIST_FROM_JSON(it, ClubLevel)
else qWarning(it.key().append(": unhandled.").toUtf8());
}
}
int MaxClubSize;
QList<Person> UnassignedStudents;
QString Name;
bool AutomaticJoiningEnabled;
bool HideFromManagementPanel;
bool Active;
bool CanBeChosen;
QString ClubPresident;
QString PreferredPresident;
int MemberCount;
int DesiredCount;
int currentClubLevelIndex;
QList<ClubLevel> ClubLevels;
};
#endif // CLUBS_H