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

    r7163 r7456  
    2828
    2929/**
    30     @file
     30    @file GlobalQuest.cc
    3131    @brief Implementation of the GlobalQuest class.
    3232*/
     
    3636#include "core/CoreIncludes.h"
    3737#include "core/XMLPort.h"
     38
    3839#include "QuestEffect.h"
    3940
     
    8485    bool GlobalQuest::fail(PlayerInfo* player)
    8586    {
    86         if(!this->isFailable(player)) //!< Check whether the Quest can be failed.
     87        if(!this->isFailable(player)) // Check whether the Quest can be failed.
    8788        {
    8889            COUT(4) << "A non-completable quest was trying to be failed." << std::endl;
     
    9293        Quest::fail(player);
    9394
    94     //! Iterate through all players possessing this Quest.
    95     for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
    96     {
    97         QuestEffect::invokeEffects(*it, this->getFailEffectList());
    98     }
    99 
    100     return true;
     95        // Iterate through all players possessing this Quest.
     96        for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
     97            QuestEffect::invokeEffects(*it, this->getFailEffectList());
     98
     99        return true;
    101100    }
    102101
     
    113112    bool GlobalQuest::complete(PlayerInfo* player)
    114113    {
    115         if(!this->isCompletable(player)) //!< Check whether the Quest can be completed.
     114        if(!this->isCompletable(player)) // Check whether the Quest can be completed.
    116115        {
    117116            COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
     
    119118        }
    120119
    121         //! Iterate through all players possessing the Quest.
     120        // Iterate through all players possessing the Quest.
    122121        for(std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)
    123         {
    124122            QuestEffect::invokeEffects(*it, this->getCompleteEffectList());
    125         }
    126123
    127124        Quest::complete(player);
    128125
    129         QuestEffect::invokeEffects(player, this->rewards_); //!< Invoke reward QuestEffects on the player completing the Quest.
     126        QuestEffect::invokeEffects(player, this->rewards_); // Invoke reward QuestEffects on the player completing the Quest.
    130127        return true;
    131128    }
     
    144141    {
    145142        if(!(this->getParentQuest() == NULL || this->getParentQuest()->isActive(player)))
    146         {
    147             return false;
    148         }
     143            return false;
     144
    149145        return (this->isInactive(player) && !(this->status_ == QuestStatus::Completed || this->status_ == QuestStatus::Failed));
    150146    }
     
    191187    QuestStatus::Value GlobalQuest::getStatus(const PlayerInfo* player) const
    192188    {
    193         if(player == NULL) //!< We don't want NULL-Pointers!
    194         {
     189        //TODO: Replace with assert.
     190        if(player == NULL) // We don't want NULL-Pointers!
    195191            ThrowException(Argument, "The input PlayerInfo* is NULL.");
    196         }
    197 
    198         //! Find the player.
     192
     193        // Find the player.
    199194        std::set<PlayerInfo*>::const_iterator it = this->players_.find((PlayerInfo*)(void*)player);
    200         if (it != this->players_.end()) //!< If the player was found.
    201         {
     195        if (it != this->players_.end()) // If the player was found.
    202196            return this->status_;
    203         }
    204197
    205198        return QuestStatus::Inactive;
     
    219212    bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status)
    220213    {
    221         if(player == NULL) //!< We don't want NULL-Pointers!
    222         {
    223             return false;
    224         }
    225 
    226         //! Find the player.
     214        //TODO: Replace with assert.
     215        if(player == NULL) // We don't want NULL-Pointers!
     216            return false;
     217
     218        // Find the player.
    227219        std::set<PlayerInfo*>::const_iterator it = this->players_.find(player);
    228         if (it == this->players_.end()) //!< Player is not yet in the list.
    229         {
    230             this->players_.insert(player); //!< Add the player to the set.
    231         }
    232 
    233         this->status_ = status; //!< Set the status, which is global, remember...?
     220        if (it == this->players_.end()) // Player is not yet in the list.
     221            this->players_.insert(player); // Add the player to the set.
     222
     223        this->status_ = status; // Set the status, which is global, remember...?
    234224        return true;
    235225    }
     
    245235    bool GlobalQuest::addRewardEffect(QuestEffect* effect)
    246236    {
    247         if(effect == NULL) //!< We don't want NULL-Pointers!
     237        //TODO: Replace with assert?
     238        if(effect == NULL) // We don't want NULL-Pointers!
    248239        {
    249240            COUT(2) << "The reward effect to be added to quest {" << this->getId() << "} was NULL." << std::endl;
     
    251242        }
    252243
    253         this->rewards_.push_back(effect); //!< Add the QuestEffect to the list.
     244        this->rewards_.push_back(effect); // Add the QuestEffect to the list.
    254245
    255246        COUT(4) << "Reward effect was added to Quest {" << this->getId() << "}." << std::endl;
     
    271262        {
    272263            if(i == 0)
    273             {
    274264               return *effect;
    275             }
     265
    276266            i--;
    277267        }
     
    279269    }
    280270
    281 
    282271}
Note: See TracChangeset for help on using the changeset viewer.