Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 6, 2008, 12:02:05 AM (16 years ago)
Author:
dafrick
Message:

Started implementation of QuestEffectBeacon.
Done some documentation of QuestItem and subclasses.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem2/src/orxonox/objects/quest/QuestHint.cc

    r2105 r2146  
    2626 *
    2727 */
     28 
     29/**
     30    @file QuestHint.cc
     31    @brief
     32        Implementation of the QuestHint class.
     33*/
    2834
    2935#include "OrxonoxStableHeaders.h"
     
    3339#include "util/Exception.h"
    3440
     41#include "orxonox/objects/worldentities/ControllableEntity.h"
    3542#include "Quest.h"
    3643
     
    4148    /**
    4249    @brief
    43         Constructor.
     50        Constructor. Initializes the object.
    4451    */
    4552    QuestHint::QuestHint(BaseObject* creator) : QuestItem(creator)
    4653    {
     54        this->initialize();
     55    }
     56   
     57    /**
     58    @brief
     59        Initialize the object.
     60    */
     61    void QuestHint::initialize(void)
     62    {
    4763        RegisterObject(QuestHint);
    48 
    49         this->initialize();
    5064    }
    5165
     
    5973    }
    6074
    61     void QuestHint::initialize(void)
    62     {
    63         RegisterObject(QuestHint);
    64     }
    65 
     75    /**
     76    @brief
     77        Method for creating a QuestHint object through XML.
     78    */
    6679    void QuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    6780    {
     
    8295        Returns true if the hint is active for the specified player.
    8396    */
    84     bool QuestHint::isActive(Player* player)
     97    bool QuestHint::isActive(ControllableEntity* player)
    8598    {
    86         if(player == NULL)
     99        if(player == NULL) //!< NULL-Pointers are ugly!
    87100        {
    88             ThrowException(Argument, "The input Player* is NULL.");
     101            ThrowException(Argument, "The input ControllableEntity* is NULL.");
    89102            return false;
    90103        }
    91104
    92         std::map<Player*, questHintStatus::Enum>::iterator it = this->playerStatus_.find(player);
    93         if (it != this->playerStatus_.end())
     105        //! Find the player.
     106        std::map<ControllableEntity*, questHintStatus::Enum>::iterator it = this->playerStatus_.find(player);
     107        if (it != this->playerStatus_.end()) //!< If the player is in the map.
    94108        {
    95109            return it->second;
    96110        }
     111       
    97112        return questStatus::inactive;
    98113    }
     
    106121        Returns true if the activation was successful, false if there were problems.
    107122    */
    108     bool QuestHint::activate(Player* player)
     123    bool QuestHint::setActive(ControllableEntity* player)
    109124    {
    110         if(this->quest_->isActive(player))
     125        if(this->quest_->isActive(player)) //!< For a hint to get activated the quest must be active.
    111126        {
    112             if(!(this->isActive(player)))
     127            if(!(this->isActive(player)))  //!< If the hint is already active, activation is pointless.
    113128            {
    114129                this->playerStatus_[player] = questHintStatus::active;
     
    121136            }
    122137        }
     138       
    123139        COUT(2) << "A hint of a non-active quest was trying to get activated." << std::endl;
    124140        return false;
     
    129145        Sets the quest the QuestHitn belongs to.
    130146    @param quest
     147        The quest to be set as quest the hint is attached to.
    131148    @return
     149        Returns true if successful.
    132150    */
    133151    bool QuestHint::setQuest(Quest* quest)
    134152    {
    135         if(quest == NULL)
     153        if(quest == NULL) //!< NULL-Pointer. Again..?
    136154        {
    137155            COUT(2) << "The input Quest* is NULL." << std::endl;
Note: See TracChangeset for help on using the changeset viewer.