Repository navigation
Expand file tree
/
Copy pathrulechoice.h
More file actions
75 lines (71 loc) · 2.03 KB
/
Copy pathrulechoice.h
File metadata and controls
75 lines (71 loc) · 2.03 KB
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
#ifndef RULECHOICE_H
#define RULECHOICE_H
#include <QList>
#include "json_macros.h"
#include "ruleeffect.h"
#include "theworld.h"
class RuleChoice {
QList<RuleEffect> RuleEffects;
public:
QString Name;
QString Description;
RuleStatus Status;
QString NeedRoom;
double RuleReputation;
bool NudeOutfit;
bool NudeSwimsuit;
RuleChoice(QJsonObject *d = NULL) :
Name(""), Description(""), Status(RuleStatus::Available), NeedRoom("")
{
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, Description, toString)
else __IF_ENUM_FROM_JSON_AS(it, Status, RuleStatus)
else __IF_VAR_FROM_JSON_AS(it, NeedRoom, toString)
else __IF_VAR_FROM_JSON_AS(it, RuleReputation, toDouble)
else __IF_VAR_FROM_JSON_AS(it, NudeOutfit, toBool)
else __IF_VAR_FROM_JSON_AS(it, NudeSwimsuit, toBool)
else __IF_OBJLIST_FROM_JSON(it, RuleEffects, RuleEffect)
}
}
bool ShouldSerializeStatus()
{
return Status > RuleStatus::Available;
}
bool ShouldSerializeNeedRoom()
{
return !NeedRoom.isEmpty();
}
bool ShouldSerializeRuleReputation()
{
return RuleReputation != 0.0;
}
bool ShouldSerializeNudeOutfit()
{
return NudeOutfit;
}
bool ShouldSerializeNudeSwimsuit()
{
return NudeSwimsuit;
}
void ExecuteRule()
{
/*if (Game.HiredTeacher.count() > 0)
{
for (QList<RuleEffect>::iterator it = RuleEffects.begin();
it != RuleEffects.end(); ++it)
it->ExecuteRuleForGroup();
TheWorld *theSchool = &Game.TheSchool;
theSchool->Reputation = theSchool->Reputation + RuleReputation / 5.0;
}*/
}
QString ToString()
{
return "RuleChoice: " + Name;
}
};
#endif // RULECHOICE_H