Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/questsystem/src/orxonox/objects/QuestHint.cc @ 2021

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

Nearly compiles, some minor improvements.

File size: 2.7 KB
RevLine 
[1992]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"
[2021]30
31#include "Quest.h"
[1992]32#include "QuestHint.h"
33
34namespace orxonox {
35
36    CreateFactory(QuestHint);
37
[2021]38    QuestHint::QuestHint() : QuestItem()
39    {
40       
41    }
42
[1992]43    /**
44    @brief
45        Constructor.  Needs as input a unique identifier to be able to identify different instances of this class (and subclasses).
46    @param id
47        The unique identifier.
48    @param title
49        The title of the hint.
50    @param description
51        The description of the hint, resp. the hint itself.
52    */
[2021]53    QuestHint::QuestHint(std::string id, std::string title, std::string description) : QuestItem(id, title, description)
[1992]54    {
55        RegisterObject(QuestHint);
56    }
57   
58    /**
59    @brief
60        Destructor.
61    */
62    QuestHint::~QuestHint()
63    {
64       
65    }
66   
[1996]67    /**
68    @brief
69        Checks whether the hint is active for a specific player.
70    @param player
71        The player.
72    @return
73        Returns
74    */
[2021]75    bool QuestHint::isActive(Player* player)
[1992]76    {
[2021]77        std::map<Player*, questHintStatus::Enum>::iterator it = this->playerStatus_.find(player);
[1996]78        if (it != this->playerStatus_.end())
79        {
80            return it->second;
81        }
82        return questStatus::inactive;
[1992]83    }
84   
[2021]85    /**
86    @brief
87    @param player
88    @return
89    */
90    bool QuestHint::activate(Player* player)
[1992]91    {
[2021]92        if(this->quest_->isActive(player) && !(this->isActive(player)))
[1992]93        {
[2021]94            this->playerStatus_[player] = questHintStatus::active;
[1996]95            return true;
[1992]96        }
[1996]97        COUT(2) << "A hint of a non-active quest was trying to get activated." << std::endl;
98        return false;
[1992]99    }
100
[2021]101    /**
102    @brief
103    @param quest
104    @return
105    */
[1992]106    void QuestHint::setQuest(Quest* quest)
107    {
108        this->quest_ = quest;
109    }
110
111}
Note: See TracBrowser for help on using the repository browser.