Crossfire Server, Trunk  R20513
Quest.cpp
Go to the documentation of this file.
1 #include "Quest.h"
2 
4 {
5  myStep = 0;
6  myIsCompletion = false;
7 }
8 
9 int QuestStep::step() const
10 {
11  return myStep;
12 }
13 
15 {
16  myStep = step;
17 }
18 
19 const QString& QuestStep::description() const
20 {
21  return myDescription;
22 }
23 
25 {
26  myDescription = description.trimmed();
27 }
28 
30 {
31  return myIsCompletion;
32 }
33 
34 void QuestStep::setCompletion(bool completion)
35 {
36  myIsCompletion = completion;
37 }
38 
39 const QStringList& QuestStep::setWhen() const
40 {
41  return mySetWhen;
42 }
43 
44 QStringList& QuestStep::setWhen()
45 {
46  return mySetWhen;
47 }
48 
49 
51 {
52  myCanRestart = false;
53  myModified = false;
54  myParent = NULL;
55  myFaceNumber = 0;
56 }
57 
59 {
60  qDeleteAll(mySteps);
61 }
62 
63 const QString& Quest::code() const
64 {
65  return myCode;
66 }
67 
68 void Quest::setCode(const QString& code)
69 {
70  if (code == myCode)
71  return;
72  myCode = code;
73  markModified();
74 }
75 
76 const QString& Quest::title() const
77 {
78  return myTitle;
79 }
80 
81 void Quest::setTitle(const QString& title)
82 {
83  if (title.trimmed() == myTitle)
84  return;
85  myTitle = title.trimmed();
86  markModified();
87 }
88 
89 const QString& Quest::face() const
90 {
91  return myFace;
92 }
93 
94 void Quest::setFace(const QString& face)
95 {
96  if (myFace == face)
97  return;
98  myFace = face;
99  markModified();
100 }
101 
102 int Quest::faceNumber() const
103 {
104  return myFaceNumber;
105 }
106 
107 void Quest::setFaceNumber(int face)
108 {
109  myFaceNumber = face;
110 }
111 
112 const QString& Quest::description()const
113 {
114  return myDescription;
115 }
116 
117 void Quest::setDescription(const QString& description)
118 {
119  if (description.trimmed() == myDescription)
120  return;
121  myDescription = description.trimmed();
122  markModified();
123 }
124 
125 bool Quest::canRestart() const
126 {
127  return myCanRestart;
128 }
129 
130 void Quest::setRestart(bool restart)
131 {
132  if (myCanRestart == restart)
133  return;
134  myCanRestart = restart;
135  markModified();
136 }
137 
138 QList<const QuestStep*> Quest::steps() const
139 {
140  QList<const QuestStep*> steps;
141  foreach(const QuestStep* step, mySteps)
142  steps.append(step);
143  return steps;
144 }
145 
146 QList<QuestStep*>& Quest::steps()
147 {
148  return mySteps;
149 }
150 
151 bool Quest::isModified() const
152 {
153  return myModified;
154 }
155 void Quest::setModified(bool modified)
156 {
157  myModified = modified;
158 }
159 
161 {
162  setModified(true);
163  emit modified();
164 }
165 
166 const Quest* Quest::parent() const
167 {
168  return myParent;
169 }
170 
171 void Quest::setParent(Quest* parent)
172 {
173  if (parent != myParent)
174  {
175  myParent = parent;
176  markModified();
177  }
178 }
179 
180 QList<CREMapInformation*>& Quest::maps()
181 {
182  return myMaps;
183 }
void setRestart(bool restart)
Definition: Quest.cpp:130
const QStringList & setWhen() const
Definition: Quest.cpp:39
const Quest * parent() const
Definition: Quest.cpp:166
Definition: Quest.h:32
QList< const QuestStep * > steps() const
Definition: Quest.cpp:138
const QString & code() const
Definition: Quest.cpp:63
Information on one title.
Definition: readable.c:106
void setTitle(const QString &title)
Definition: Quest.cpp:81
int faceNumber() const
Definition: Quest.cpp:102
void setStep(int step)
Definition: Quest.cpp:14
int myStep
Definition: Quest.h:26
const QString & face() const
Definition: Quest.cpp:89
const QString & description() const
Definition: Quest.cpp:112
const QString & title() const
Definition: Quest.cpp:76
void setDescription(const QString &description)
Definition: Quest.cpp:117
bool isModified() const
Definition: Quest.cpp:151
QStringList mySetWhen
Definition: Quest.h:29
Definition: Quest.h:9
bool myIsCompletion
Definition: Quest.h:28
void setCompletion(bool completion)
Definition: Quest.cpp:34
virtual ~Quest()
Definition: Quest.cpp:58
bool canRestart() const
Definition: Quest.cpp:125
void setCode(const QString &code)
Definition: Quest.cpp:68
int step() const
Definition: Quest.cpp:9
void setParent(Quest *parent)
Definition: Quest.cpp:171
const QString & description() const
Definition: Quest.cpp:19
QuestStep()
Definition: Quest.cpp:3
bool isCompletion() const
Definition: Quest.cpp:29
void setFaceNumber(int face)
Definition: Quest.cpp:107
void markModified()
Definition: Quest.cpp:160
void setDescription(const QString &description)
Definition: Quest.cpp:24
void setModified(bool modified)
Definition: Quest.cpp:155
QString myDescription
Definition: Quest.h:27
void setFace(const QString &face)
Definition: Quest.cpp:94
Quest()
Definition: Quest.cpp:50
QList< CREMapInformation * > & maps()
Definition: Quest.cpp:180