Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 25, 2008, 11:56:40 PM (15 years ago)
Author:
landauf
Message:

merged questsystem2 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/quest/AddQuestHint.cc

    r2105 r2261  
    2727 */
    2828
     29/**
     30    @file AddQuestHint.cc
     31    @brief
     32    Implementation of the AddQuestHint class.
     33*/
     34
    2935#include "OrxonoxStableHeaders.h"
    3036#include "AddQuestHint.h"
     
    3339#include "util/Exception.h"
    3440
     41#include "orxonox/objects/infos/PlayerInfo.h"
    3542#include "QuestManager.h"
    3643#include "QuestItem.h"
     
    4148    CreateFactory(AddQuestHint);
    4249
     50    /**
     51    @brief
     52        Constructor. Registers the object.
     53    */
    4354    AddQuestHint::AddQuestHint(BaseObject* creator) : QuestEffect(creator)
    4455    {
     
    5465    }
    5566
     67    /**
     68    @brief
     69        Method for creating a AddQuestHint object through XML.
     70    */
    5671    void AddQuestHint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5772    {
     
    5974
    6075        XMLPortParam(AddQuestHint, "hintId", setHintId, getHintId, xmlelement, mode);
    61 
     76       
     77        COUT(3) << "New AddQuestHint, with target QuestHint {" << this->getHintId() << "}, created." << std::endl;
    6278    }
    6379
    64     inline void AddQuestHint::setHintId(const std::string & id)
     80    /**
     81    @brief
     82        Sets the id of the QuestHint to be added to the player the QuestEffect is invoked on.
     83    @param id
     84        The QuestHint id.
     85    @param
     86        Returns true if successful.
     87    */
     88    bool AddQuestHint::setHintId(const std::string & id)
    6589    {
    6690        if(!QuestItem::isId(id))
    6791        {
    6892            COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
    69             return;
     93            return false;
    7094        }
     95       
    7196        this->hintId_ = id;
     97        return true;
    7298    }
    7399
    74100    /**
    75101    @brief
    76         Invokes the effect.
     102        Invokes the QuestEffect.
    77103    @param player
    78104        The player.
    79105    @return
    80         Returns true if the effect was successfully invoked.
     106        Returns true if the QuestEffect was successfully invoked.
    81107    */
    82     bool AddQuestHint::invoke(Player* player)
     108    bool AddQuestHint::invoke(PlayerInfo* player)
    83109    {
    84         if(player == NULL)
     110        if(player == NULL) //!< NULL-pointers are evil!
    85111        {
    86112            COUT(2) << "The input player is NULL." << std::endl;
     
    88114        }
    89115
     116        COUT(3) << "AddQuestHint on player: " << player << " ." << std::endl;
     117
    90118        try
    91119        {
    92120            QuestHint* hint = QuestManager::findHint(this->hintId_);
    93             if(!hint->activate(player))
     121            if(hint == NULL || !hint->setActive(player))
    94122            {
    95123                return false;
     
    102130        }
    103131
     132        COUT(3) << "QuestHint {" << this->getHintId() << "} successfully added to player." << std::endl;
    104133        return true;
    105134
Note: See TracChangeset for help on using the changeset viewer.