Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/questsystem/src/orxonox/objects/QuestItem.cc @ 2068

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

Started with XMLPort…

File size: 3.0 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#include "core/CoreIncludes.h"
30
31#include "QuestItem.h"
32
33namespace orxonox {
34
35    CreateFactory(QuestItem);
36   
37    QuestItem::QuestItem() : BaseObject()
38    {
39        this->initialize();
40    }
41   
42    /**
43    @brief
44        Constructor. Needs as input a unique identifier to be able to identify different instances of this class (and subclasses).
45    @param id
46        The unique identifier. Should be of GUID form: http://en.wikipedia.org/wiki/Globally_Unique_Identifier#Basic_structure
47    */
48    QuestItem::QuestItem(std::string id) : BaseObject()
49    {
50        this->initialize();
51       
52        this->id_ = id;
53    }
54   
55    /**
56    @brief
57        Destructor.
58    */
59    QuestItem::~QuestItem()
60    {
61       
62    }
63   
64    void QuestItem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
65    {
66        SUPER(QuestItem, XMLPort, xmlelement, mode);
67       
68        XMLPortParam(QuestItem, "id", setId, getId, xmlelement, mode);
69        //Doesn't getDescription have to be of type getDescription(unsigned int) ?
70        //XMLPortObjectTemplate(QuestItem, QuestDescription, "", setDescription, getDescription, xmlelement, mode, unsigned int);
71        XMLPortObject(QuestItem, QuestDescription, "", setDescription, getDescription, xmlelement, mode);
72
73    }
74
75   
76    /**
77    @brief
78        Initializes the object.
79        Should be called first in every constructor of this class.
80    */
81    void QuestItem::initialize(void)
82    {
83        RegisterObject(QuestItem);
84       
85        this->id_ = "";
86    }
87   
88    //const QuestDescription* QuestItem::getDescription(unsigned int index) const //!< Returns the description of the QuestItem.
89    //{
90    //    if(index != 0)
91    //        return NULL;
92    //    return this->description_;
93    //}
94   
95    /**
96    @brief
97        Checks whether an input id is of the required form.
98    @param id
99        The id to be checked.
100    @return
101        Returns true if the string is likely to be of the required form.
102    @todo
103        Clarify form, more vigorous checks.
104    */
105    bool QuestItem::isId(const std::string & id)
106    {
107        return id.size() >= 32;
108    }
109
110}
Note: See TracBrowser for help on using the repository browser.