Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/questsystem/src/orxonox/objects/Quest.h @ 1992

Last change on this file since 1992 was 1992, checked in by dafrick, 16 years ago

Base of the quest system object hirarchy.
Doesn's compile, yet (or so I assume), and is nowhere near complete or failproof.

File size: 4.2 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Damian 'Mozork' Frick
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _Quest_H__
30#define _Quest_H__
31
32#include <list>
33#include <string>
34
35#include "orxonox/quests/QuestDescription.h"
36#include "QuestItem.h"
37#include "QuestHint.h"
38#include "QuestEffect.h"
39
40namespace orxonox {
41
42    /**
43    @brief
44        Represents a quest in the game.
45        A quest has a sub
46       
47    @author
48        Damian 'Mozork' Frick
49    */
50    class Quest : public QuestItem
51    {
52        public:
53            Quest(std::string id, std::string title = "", std::string description = "");
54            ~Quest();
55   
56            inline Quest* getParentQuest(void) const //!< Returns the parent quest of the quest.
57                { return this->parentQuest_; }
58            inline const std::list<Quest> & getSubQuest(void) const //!< Returns the list of sub quests.
59                { return this->subQuests_; }
60           
61            //TDO: Necessary? Shouldn't this be decided whilest creating the object?
62            inline void setParentQuest(Quest* quest) //!< Sets the parent quest of the quest.
63                { this->parentQuest_ = quest; }
64            inline void addSubQuest(Quest & quest) //!< Adds a sub quest to the quest.
65                { this->subQuests_.push_back = quest; }
66           
67            inline bool isInactive(const Player & player) const //!< Returns true if the quest status for the specific player is 'inactive'.
68               { return this->getStatus(player) != questStatus::inactive; }
69            inline bool isActive(const Player & player) const //!< Returns true if the quest status for the specific player is 'active'.
70               { return this->getStatus(player) == questStatus::active; }
71            inline bool isFailed(const Player & player) const //!< Returns true if the quest status for the specific player is 'failed'.
72               { return this->getStatus(player) == questStatus::failed; }
73            inline bool isCompleted(const Player & player) const //!< Returns true if the quest status for the specific player is 'completed'.
74               { return this->getStatus(player) == questStatus::completed; }
75               
76            void start(const Player & player); //!< Sets a quest to pending.
77            void fail(Player & player); //!< Fails the quest.
78            void complete(Player & player); //!< Completes the quest.
79               
80            void addHint(QuestHint & hint); //!< Add a hint to the list of hints.
81           
82        protected:
83            void initialize(void); //!< Initialized the object.
84           
85            virtual questStatus::Enum getStatus(const Player & player) const = 0; //!< Returns the status of the quest for a specific player.
86            virtual void setStatus(const Player & player, const questStatus::Enum & status) = 0; //!< Changes the status for a specific player.
87           
88            Quest* parentQuest_; //!< Pointer to the parent quest.
89            std::list<Quest> subQuests_; //!< List of all the sub quests.
90           
91            std::list<QuestHint> hints_; //!< A list of all the hints tied to this quest.
92           
93            std::list<QuestEffect> failEffects_; //!< A list of all effects to be invoked, when the quest has been failed.
94            std::list<QuestEffect> completeEffects_; //!< A list of effects to be invoked, when the quest has been completed.
95
96    };
97
98}
99
100namespace questStatus
101{
102
103    enum Enum
104    {
105        inactive,
106        active,
107        failed,
108        completed
109    };
110
111}
112
113#endif /* _Quest_H__ */
Note: See TracBrowser for help on using the repository browser.