Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 15, 2010, 7:29:16 PM (14 years ago)
Author:
dafrick
Message:

Reviewing documentation fo Questsystem, moving documentation fully into doxygen.
Added some files to modules they belong to.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/questsystem/Quest.cc

    r7403 r7456  
    2828
    2929/**
    30     @file
     30    @file Quest.cc
    3131    @brief Implementation of the Quest class.
    3232*/
     
    3636#include "core/CoreIncludes.h"
    3737#include "core/XMLPort.h"
     38
     39#include "QuestDescription.h"
     40#include "QuestEffect.h"
     41#include "QuestHint.h"
     42#include "QuestListener.h"
    3843#include "QuestManager.h"
    39 #include "QuestDescription.h"
    40 #include "QuestHint.h"
    41 #include "QuestEffect.h"
    42 #include "QuestListener.h"
    4344
    4445namespace orxonox
     
    7879        XMLPortObject(Quest, QuestEffect, "complete-effects", addCompleteEffect, getCompleteEffect, xmlelement, mode);
    7980
    80         QuestManager::getInstance().registerQuest(this); //!<Registers the Quest with the QuestManager.
    81     }
    82 
    83     /**
    84     @brief
    85         Sets the parentquest of the Quest.
     81        QuestManager::getInstance().registerQuest(this); // Registers the Quest with the QuestManager.
     82    }
     83
     84    /**
     85    @brief
     86        Sets the parent-quest of the Quest.
    8687    @param quest
    87         A pointer to the Quest to be set as parentquest.
    88     @return
    89         Returns true if the parentquest could be set.
     88        A pointer to the Quest to be set as parent-quest.
     89    @return
     90        Returns true if the parent-quest could be set.
    9091    */
    9192    bool Quest::setParentQuest(Quest* quest)
    9293    {
    93         if(quest == NULL) //!< We don't want to set NULL-Pointers.
     94        //TODO: Replace with assert.
     95        if(quest == NULL) // We don't want to set NULL-Pointers.
    9496        {
    9597            COUT(2) << "The parentquest to be added to quest {" << this->getId() << "} was NULL." << std::endl;
     
    105107    /**
    106108    @brief
    107         Adds a subquest to the Quest.
     109        Adds a sub-quest to the Quest.
    108110    @param quest
    109         A pointer to the Quest to be set as subquest.
    110     @return
    111         Returns true if the subquest could be set.
     111        A pointer to the Quest to be set as sub-quest.
     112    @return
     113        Returns true if the sub-quest could be set.
    112114    */
    113115    bool Quest::addSubQuest(Quest* quest)
    114116    {
    115         if(quest == NULL) //!< We don't want to set NULL-Pointers.
     117        //TODO: Replace with assert.
     118        if(quest == NULL) // We don't want to set NULL-Pointers.
    116119        {
    117120            COUT(2) << "The subquest to be added to quest {" << this->getId() << "} was NULL." << std::endl;
     
    119122        }
    120123
    121         quest->setParentQuest(this); //!< Sets the currentQuest (this) as parentquest for the added subquest.
    122         this->subQuests_.push_back(quest); //!< Adds the Quest to the end of the list of subquests.
     124        quest->setParentQuest(this); // Sets the currentQuest (this) as parent-quest for the added sub-quest.
     125        this->subQuests_.push_back(quest); // Adds the Quest to the end of the list of sub-quests.
    123126
    124127        COUT(4) << "Sub Quest {" << quest->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
     
    137140    bool Quest::addHint(QuestHint* hint)
    138141    {
    139         if(hint == NULL) //!< We don't want to set NULL-Pointers. Seriously!
     142        //TODO: Replace with assert.
     143        if(hint == NULL) // We don't want to set NULL-Pointers. Seriously!
    140144        {
    141145            COUT(2) << "A NULL-QuestHint was trying to be added." << std::endl;
     
    143147        }
    144148
    145         hint->setQuest(this); //!< Sets the current Quest (this) as Quest for the added QuestHint.
    146         this->hints_.push_back(hint); //!< Adds the QuestHint to the end of the list of QuestHints.
     149        hint->setQuest(this); // Sets the current Quest (this) as Quest for the added QuestHint.
     150        this->hints_.push_back(hint); // Adds the QuestHint to the end of the list of QuestHints.
    147151
    148152        COUT(4) << "QuestHint {" << hint->getId() << "} was added to Quest {" << this->getId() << "}." << std::endl;
     
    160164    bool Quest::addFailEffect(QuestEffect* effect)
    161165    {
    162         if(effect == NULL) //!< We don't want to set NULL-Pointers.
     166        //TODO: Replace with assert.
     167        if(effect == NULL) // We don't want to set NULL-Pointers.
    163168        {
    164169            COUT(2) << "A NULL-QuestEffect was trying to be added" << std::endl;
     
    166171        }
    167172
    168         this->failEffects_.push_back(effect); //!< Adds the QuestEffect to the end of the list of fail QuestEffects.
     173        this->failEffects_.push_back(effect); // Adds the QuestEffect to the end of the list of fail QuestEffects.
    169174
    170175        COUT(4) << "A FailEffect was added to Quest {" << this->getId() << "}." << std::endl;
     
    182187    bool Quest::addCompleteEffect(QuestEffect* effect)
    183188    {
    184         if(effect == NULL) //!< We don't want to set NULL-Pointers.
     189        //TODO: Replace with assert.
     190        if(effect == NULL) // We don't want to set NULL-Pointers.
    185191        {
    186192            COUT(2) << "A NULL-QuestEffect was trying to be added" << std::endl;
     
    188194        }
    189195
    190         this->completeEffects_.push_back(effect); //!< Adds the QuestEffect to the end of the list of complete QuestEffects.
     196        this->completeEffects_.push_back(effect); // Adds the QuestEffect to the end of the list of complete QuestEffects.
    191197
    192198        COUT(4) << "A CompleteEffect was added to Quest {" << this->getId() << "}." << std::endl;
     
    196202    /**
    197203    @brief
    198         Returns the subquest at the given index.
     204        Returns the sub-quest at the given index.
    199205    @param index
    200206        The index.
    201207    @return
    202         Returns a pointer to the subquest at the given index. NULL if there is no element at the given index.
     208        Returns a pointer to the sub-quest at the given index. NULL if there is no element at the given index.
    203209    */
    204210    const Quest* Quest::getSubQuest(unsigned int index) const
     
    206212        int i = index;
    207213
    208         //! Iterate through all subquests.
     214        // Iterate through all subquests.
    209215        for (std::list<Quest*>::const_iterator subQuest = this->subQuests_.begin(); subQuest != this->subQuests_.end(); ++subQuest)
    210216        {
    211             if(i == 0) //!< We're counting down...
    212             {
     217            if(i == 0) // We're counting down...
    213218               return *subQuest;
    214             }
     219
    215220            i--;
    216221        }
    217222
    218         return NULL; //!< If the index is greater than the number of elements in the list.
     223        return NULL; // If the index is greater than the number of elements in the list.
    219224    }
    220225
     
    231236        int i = index;
    232237
    233         //! Iterate through all QuestHints.
     238        // Iterate through all QuestHints.
    234239        for (std::list<QuestHint*>::const_iterator hint = this->hints_.begin(); hint != this->hints_.end(); ++hint)
    235240        {
    236             if(i == 0) //!< We're counting down...
    237             {
     241            if(i == 0) // We're counting down...
    238242               return *hint;
    239             }
     243
    240244            i--;
    241245        }
    242         return NULL; //!< If the index is greater than the number of elements in the list.
     246        return NULL; // If the index is greater than the number of elements in the list.
    243247    }
    244248
     
    255259        int i = index;
    256260
    257         //! Iterate through all fail QuestEffects.
     261        // Iterate through all fail QuestEffects.
    258262        for (std::list<QuestEffect*>::const_iterator effect = this->failEffects_.begin(); effect != this->failEffects_.end(); ++effect)
    259263        {
    260             if(i == 0) //!< We're counting down...
    261             {
     264            if(i == 0) // We're counting down...
    262265               return *effect;
    263             }
     266
    264267            i--;
    265268        }
    266         return NULL; //!< If the index is greater than the number of elements in the list.
     269        return NULL; // If the index is greater than the number of elements in the list.
    267270    }
    268271
     
    279282        int i = index;
    280283
    281         //! Iterate through all complete QuestEffects.
     284        // Iterate through all complete QuestEffects.
    282285        for (std::list<QuestEffect*>::const_iterator effect = this->completeEffects_.begin(); effect != this->completeEffects_.end(); ++effect)
    283286        {
    284             if(i == 0) //!< We're counting down...
    285             {
     287            if(i == 0) // We're counting down...
    286288               return *effect;
    287             }
     289
    288290            i--;
    289291        }
    290         return NULL; //!< If the index is greater than the number of elements in the list.
     292        return NULL; // If the index is greater than the number of elements in the list.
    291293    }
    292294
     
    318320    bool Quest::isActive(const PlayerInfo* player) const
    319321    {
    320 
    321322        return this->getStatus(player) == QuestStatus::Active;
    322323    }
     
    362363    bool Quest::fail(PlayerInfo* player)
    363364    {
    364         QuestListener::advertiseStatusChange(this->listeners_, "fail"); //!< Tells the QuestListeners, that the status has changed to failed.
     365        QuestListener::advertiseStatusChange(this->listeners_, "fail"); // Tells the QuestListeners, that the status has changed to failed.
    365366        this->setStatus(player, QuestStatus::Failed);
    366367
     
    381382    bool Quest::complete(PlayerInfo* player)
    382383    {
    383         QuestListener::advertiseStatusChange(this->listeners_, "complete"); //!< Tells the QuestListeners, that the status has changed to completed.
     384        QuestListener::advertiseStatusChange(this->listeners_, "complete"); // Tells the QuestListeners, that the status has changed to completed.
    384385        this->setStatus(player, QuestStatus::Completed);
    385386
     
    400401    bool Quest::start(PlayerInfo* player)
    401402    {
    402         if(!this->isStartable(player)) //!< Checks whether the quest can be started.
     403        if(!this->isStartable(player)) // Checks whether the quest can be started.
    403404        {
    404405            COUT(4) << "A non-startable quest was trying to be started." << std::endl;
     
    408409        COUT(4) << "Quest {" << this->getId() << "} is started for player: " << player << " ." <<std::endl;
    409410
    410         QuestListener::advertiseStatusChange(this->listeners_, "start"); //!< Tells the QuestListeners, that the status has changed to active.
     411        QuestListener::advertiseStatusChange(this->listeners_, "start"); // Tells the QuestListeners, that the status has changed to active.
    411412
    412413        this->setStatus(player, QuestStatus::Active);
     
    426427    bool Quest::addListener(QuestListener* listener)
    427428    {
     429        //TODO: Replace with assert?
    428430        if(listener == NULL)
    429431        {
Note: See TracChangeset for help on using the changeset viewer.