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/FailQuest.cc

    r2105 r2261  
    2626 *
    2727 */
     28 
     29/**
     30    @file FailQuest.cc
     31    @brief
     32    Implementation of the FailQuest class.
     33*/
    2834
    2935#include "OrxonoxStableHeaders.h"
     
    3339#include "util/Exception.h"
    3440
     41#include "orxonox/objects/infos/PlayerInfo.h"
    3542#include "QuestManager.h"
    3643#include "Quest.h"
     
    4047    CreateFactory(FailQuest);
    4148
     49    /**
     50    @brief
     51        Constructor. Registers the object.
     52    */
    4253    FailQuest::FailQuest(BaseObject* creator) : ChangeQuestStatus(creator)
    4354    {
     
    5364    }
    5465
     66    /**
     67    @brief
     68        Method for creating a FailQuest object through XML.
     69    */
    5570    void FailQuest::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5671    {
    5772        SUPER(FailQuest, XMLPort, xmlelement, mode);
     73       
     74        COUT(3) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
    5875    }
    5976
    6077    /**
    6178    @brief
    62         Invokes the effect.
     79        Invokes the QuestEffect.
    6380    @param player
    64         The player the effect is invoked on.
     81        The player the QuestEffect is invoked on.
    6582    @return
    66         Returns true if the effect was invoked successfully.
     83        Returns true if the QuestEffect was invoked successfully.
    6784    */
    68     bool FailQuest::invoke(Player* player)
     85    bool FailQuest::invoke(PlayerInfo* player)
    6986    {
    70         if(player == NULL)
     87        if(player == NULL) //!< We don't know what to do with no player.
    7188        {
    7289            COUT(2) << "Input player is NULL." << std::endl;
     
    7491        }
    7592
     93        COUT(3) << "FailQuest on player: " << player << " ." << std::endl;
     94
     95        Quest* quest;
    7696        try
    7797        {
    78             Quest* quest = QuestManager::findQuest(this->getQuestId());
    79             if(!quest->fail(player))
     98            quest = QuestManager::findQuest(this->getQuestId());
     99            if(quest == NULL || !quest->fail(player))
    80100            {
    81101               return false;
     
    87107            return false;
    88108        }
    89 
     109       
     110        COUT(3) << "Quest {" << quest->getId() << "} failed by player: " << player << " ." << std::endl;
    90111        return true;
    91112    }
Note: See TracChangeset for help on using the changeset viewer.