ScummVM API documentation
quests.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ULTIMA_ULTIMA1_CORE_QUESTS_H
23 #define ULTIMA_ULTIMA1_CORE_QUESTS_H
24 
25 #include "common/array.h"
26 #include "common/serializer.h"
27 
28 namespace Ultima {
29 namespace Ultima1 {
30 
31 #define FLAGS_COUNT 9
32 
33 class Ultima1Game;
34 
38 class QuestFlag {
39  enum FlagState { UNSTARTED = 0, IN_PROGRESS = -1, COMPLETED = 1 };
40 private:
41  Ultima1Game *_game;
42  FlagState _state;
43 public:
47  QuestFlag() : _game(nullptr), _state(UNSTARTED) {}
48 
52  QuestFlag(Ultima1Game *game) : _game(game), _state(UNSTARTED) {}
53 
58 
62  bool isUnstarted() const { return _state == UNSTARTED; }
63 
67  bool isInProgress() const { return _state == IN_PROGRESS; }
68 
72  bool isComplete() const { return _state == COMPLETED; }
73 
77  void start();
78 
82  void complete();
83 };
87 class Quests : public Common::Array<QuestFlag> {
88 public:
92  Quests(Ultima1Game *game);
93 
98 };
99 
100 } // End of namespace Ultima1
101 } // End of namespace Ultima
102 
103 #endif
bool isComplete() const
Definition: quests.h:72
Definition: array.h:52
Definition: quests.h:38
Definition: serializer.h:79
Definition: detection.h:27
bool isInProgress() const
Definition: quests.h:67
Definition: game.h:42
QuestFlag()
Definition: quests.h:47
QuestFlag(Ultima1Game *game)
Definition: quests.h:52
Definition: quests.h:87
void synchronize(Common::Serializer &s)
bool isUnstarted() const
Definition: quests.h:62