Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation3/src/modules/questsystem/QuestItem.h @ 6944

Last change on this file since 6944 was 6940, checked in by dafrick, 14 years ago

Resolved issue with the Questsystem causing a segfault when a level with Quests was loaded twice. The issue still persists, but not with the Questsystem anymore and it will be addressed with my next commit.
Also removed restrictions to the number of characters a quest/hint identifier must have.

  • Property svn:eol-style set to native
File size: 3.4 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/**
30    @file
31    @brief Definition of the QuestItem class.
32        The QuestItem is the parent class of Quest and QuestHint.
33*/
34
35
36#ifndef _QuestItem_H__
37#define _QuestItem_H__
38
39#include "questsystem/QuestsystemPrereqs.h"
40
41#include <string>
42#include "core/BaseObject.h"
43#include "QuestManager.h"
44
45namespace orxonox
46{
47    /**
48    @brief
49        Functions as a base class for quest classes such as Quest or QuestHint.
50        Has a unique identifier and a description.
51    @author
52        Damian 'Mozork' Frick
53    */
54    class _QuestsystemExport QuestItem : public BaseObject
55    {
56
57        public:
58            QuestItem(BaseObject* creator);
59            virtual ~QuestItem();
60
61            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestItem object through XML.
62
63            /**
64            @brief Returns the id of this QuestItem.
65            @return Returns the id of the QuestItem.
66            */
67            inline const std::string & getId(void) const
68                { return this->id_; }
69
70            /**
71            @brief Returns the QuestDescription of the QuestItem.
72            @return Returns a pointer to the QuestDescription object of the QuestItem.
73            */
74            inline const QuestDescription* getDescription(void) const
75                { return this->description_; }
76
77            /**
78            @brief Check whether the QuestItem is registered with the QuestManager.
79            @return Returns true if the QuestItem is registered with the QuestManager.
80            */
81            inline bool isRegistered(void)
82                { return this->registered_; }
83            /**
84            @brief Set the QuestItem as being registered with the QuestManager.
85            */
86            inline void setRegistered(void)
87                { this->registered_ = true; }
88
89        protected:
90            void setId(const std::string & id); //!< Sets the id of the QuestItem.
91
92            /**
93            @brief Sets the description of the QuestItem.
94            @param description The QuestDescription to be set.
95            */
96            inline void setDescription(QuestDescription* description)
97                { this->description_ = description; }
98
99        private:
100            std::string id_; //!< Identifier. Should be of GUID form: http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure
101            QuestDescription* description_; //!< The QuestDescription of the QuestItem.
102
103            bool registered_;
104
105    };
106
107}
108
109#endif /* _QuestItem_H__ */
Note: See TracBrowser for help on using the repository browser.