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.

Location:
code/trunk/src/modules/questsystem
Files:
34 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}
  • code/trunk/src/modules/questsystem/GlobalQuest.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file GlobalQuest.h
    3131    @brief Definition of the GlobalQuest class.
     32    @ingroup Questsystem
    3233*/
    3334
     
    4546    /**
    4647    @brief
    47         GlobalQuests are Quests, that have the same status for all players.
     48        GlobalQuests are @ref orxonox::Quest "Quests", that have the same status for all players.
    4849        This means, that when a player successfully completes a GlobalQuest, it is completed for all players that have it.
    4950
    5051        Creating a GlobalQuest through XML goes as follows:
    51 
    5252        @code
    5353        <GlobalQuest id="questId">
  • code/trunk/src/modules/questsystem/LocalQuest.cc

    r7163 r7456  
    2828
    2929/**
    30     @file
     30    @file LocalQuest.cc
    3131    @brief Implementation of the LocalQuest class.
    3232*/
     
    3636#include "core/CoreIncludes.h"
    3737#include "core/XMLPort.h"
     38
    3839#include "QuestEffect.h"
    3940
     
    8283    bool LocalQuest::fail(PlayerInfo* player)
    8384    {
    84         if(!this->isFailable(player)) //!< Checks whether the quest can be failed.
     85        if(!this->isFailable(player)) // Checks whether the quest can be failed.
    8586        {
    8687            COUT(4) << "A non-failable quest was trying to be failed." << std::endl;
     
    9091        Quest::fail(player);
    9192
    92         QuestEffect::invokeEffects(player, this->getFailEffectList()); //!< Invoke the failEffects.
     93        QuestEffect::invokeEffects(player, this->getFailEffectList()); // Invoke the failEffects.
    9394        return true;
    9495    }
     
    105106    bool LocalQuest::complete(PlayerInfo* player)
    106107    {
    107         if(!this->isCompletable(player)) //!< Checks whether the Quest can be completed.
     108        if(!this->isCompletable(player)) // Checks whether the Quest can be completed.
    108109        {
    109110            COUT(4) << "A non-completable quest was trying to be completed." << std::endl;
     
    113114        Quest::complete(player);
    114115
    115         QuestEffect::invokeEffects(player, this->getCompleteEffectList()); //!< Invoke the complete QuestEffects.
     116        QuestEffect::invokeEffects(player, this->getCompleteEffectList()); // Invoke the complete QuestEffects.
    116117        return true;
    117118    }
     
    130131    {
    131132        if(!(this->getParentQuest() == NULL || this->getParentQuest()->isActive(player)))
    132         {
    133             return false;
    134         }
     133            return false;
     134
    135135        return this->isInactive(player);
    136136    }
     
    178178    QuestStatus::Value LocalQuest::getStatus(const PlayerInfo* player) const
    179179    {
    180         if(player == NULL) //!< No player has no defined status.
    181         {
     180        //TODO: Replace with assert.
     181        if(player == NULL) // No player has no defined status.
    182182            ThrowException(Argument, "The input PlayerInfo* is NULL.");
    183         }
    184183
    185184        std::map<const PlayerInfo*, QuestStatus::Value>::const_iterator it = this->playerStatus_.find(player);
    186         if (it != this->playerStatus_.end()) //!< If there is a player in the map.
    187         {
     185        if (it != this->playerStatus_.end()) // If there is a player in the map.
    188186            return it->second;
    189         }
    190 
    191         return QuestStatus::Inactive; //!< If the player is not yet in the map, that means the status of the quest form him is 'inactive'.
     187
     188        return QuestStatus::Inactive; // If the player is not yet in the map, that means the status of the quest form him is 'inactive'.
    192189    }
    193190
     
    205202    bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus::Value & status)
    206203    {
    207         if(player == NULL) //!< We can't set a status for no player.
    208         {
    209             return false;
    210         }
     204        //TODO: Replace with assert.
     205        if(player == NULL) // We can't set a status for no player.
     206            return false;
    211207
    212208        this->playerStatus_[player] = status;
  • code/trunk/src/modules/questsystem/LocalQuest.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file LocalQuest.h
    3131    @brief Definition of the LocalQuest class.
     32    @ingroup Questsystem
    3233*/
    3334
     
    4445    /**
    4546    @brief
    46         Handles Quests which have different states for different players.
    47         LocalQuests have (as opposed to GlobalQuests) a different state for each player, that means if for one player the status of the Quest changes it does not for all the other players which also possess this quest.
     47        Handles @ref orxonox::Quest "Quests" which have different states for different players.
     48        LocalQuests have (as opposed to @ref orxonox::GlobalQuest "GlobalQuests") a different state for each player, that means if for one player the status of the @ref orxonox::Quest "Quest" changes it does not for all the other players which also possess this quest.
    4849
    4950        Creating a LocalQuest through XML goes as follows:
    50 
    5151        @code
    5252        <LocalQuest id="questId">
  • 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        {
  • code/trunk/src/modules/questsystem/Quest.h

    r7163 r7456  
    2828
    2929/**
    30     @file
     30    @file Quest.h
    3131    @brief Definition of the Quest class.
    32         The Quest is the parent class of LocalQuest and GlobalQuest.
     32        The Quest class is the parent class of @ref orxonox::LocalQuest "LocalQuest" and @ref orxonox::GlobalQuest "GlobalQuest".
     33    @ingroup Questsystem
    3334*/
    3435
     
    4546    namespace QuestStatus
    4647    {
    47         //!Different states of a Quest.
     48        //! Different states of a @ref orxonox::Quest "Quest".
    4849        enum Value
    4950        {
     
    5758    /**
    5859    @brief
    59         Represents a Quest in the game.
    60         A Quest has a list of subquests and a parentquest (if it is not a rootquest).
     60        Represents a Quest in the game. A Quest is a task that the player can (or has to) fulfill upon which he will (possibly) receive some kind of reward.
     61
     62        A Quest can have a list of sub-quests and has a parent-quest (if it is not a root-quest).
    6163        Each Quest exists only once but it has a different status (inactive, active, failed or completed) for each player.
    62         A Quest has several hints (QuestHint) that can be unlocked through QuestEffects and then display aid in solving the Quest.
    63         A Quest has a list of QuestEffects that are invoked when the quest is failed and also a list of QuestEffects that are invoked, when the Quest is completed.
     64        A Quest can have several hints (QuestHint) that can be unlocked through @ref orxonox::QuestEffect "QuestEffects" and then display aid in solving the Quest.
     65        A Quest can have a list of @ref orxonox::QuestEffect "QuestEffects" that are invoked when the quest is failed and also a list of @ref orxonox::QuestEffect "QuestEffects" that are invoked, when the Quest is completed.
    6466
    65         Quest itself should not be instantiated, if you want to create a quest either go for LocalQuest or GlobalQuest, whichever suits you needs better.
     67        Quest itself should not be instantiated, if you want to create a quest either use LocalQuest or GlobalQuest, whichever suits you needs better.
    6668    @author
    6769        Damian 'Mozork' Frick
     
    7779
    7880            /**
    79             @brief Returns the parentquest of the Quest.
    80             @return Returns a pointer to the parentquest of the Quest.
     81            @brief Returns the parent-quest of the Quest.
     82            @return Returns a pointer to the parent-quest of the Quest.
    8183            */
    8284            inline Quest* getParentQuest(void) const
     
    8486
    8587            /**
    86             @brief Returns the list of subquests.
    87             @return Returns a reference to the list of subquests of the quest.
     88            @brief Returns the list of sub-quests.
     89            @return Returns a reference to the list of sub-quests of the quest.
    8890            */
    8991            inline const std::list<Quest*> & getSubQuestList(void) const
     
    113115            virtual bool isCompletable(const PlayerInfo* player) const = 0; //!< Checks whether the Quest can be completed.
    114116
    115             const Quest* getSubQuest(unsigned int index) const; //!<Returns the subquest at the given index.
     117            const Quest* getSubQuest(unsigned int index) const; //!<Returns the sub-quest at the given index.
    116118            const QuestHint* getHint(unsigned int index) const; //!< Returns the QuestHint at the given index.
    117119            const QuestEffect* getFailEffect(unsigned int index) const; //!< Returns the fail QuestEffect at the given index.
     
    136138
    137139        private:
    138             Quest* parentQuest_; //!< Pointer to the parentquest.
    139             std::list<Quest*> subQuests_; //!< List of all the subquests.
     140            Quest* parentQuest_; //!< Pointer to the parent-quest.
     141            std::list<Quest*> subQuests_; //!< List of all the sub-quests.
    140142
    141143            std::list<QuestHint*> hints_; //!< A list of all the QuestHints tied to this Quest.
     
    146148            std::list<QuestListener*> listeners_; //!< A list of QuestListeners, that listen to what exactly happens with this Quest.
    147149
    148             bool setParentQuest(Quest* quest); //!< Sets the parentquest of the Quest.
    149             bool addSubQuest(Quest* quest); //!< Adds a subquest to the Quest.
     150            bool setParentQuest(Quest* quest); //!< Sets the parent-quest of the Quest.
     151            bool addSubQuest(Quest* quest); //!< Adds a sub-quest to the Quest.
    150152            bool addHint(QuestHint* hint); //!< Add a QuestHint to the list of QuestHints.
    151153            bool addFailEffect(QuestEffect* effect); //!< Adds an QuestEffect to the list of fail QuestEffects.
  • code/trunk/src/modules/questsystem/QuestDescription.cc

    r7403 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestDescription.cc
    3131    @brief Implementation of the QuestDescription class.
    3232*/
     
    3737#include "core/CoreIncludes.h"
    3838#include "core/XMLPort.h"
     39
    3940#include "QuestNotification.h"
    4041
     
    9394        std::string message;
    9495        if(item == "hint")
    95         {
    9696            message = "You received a hint: '" + this->title_ + '\'';
    97         }
    9897        else if(item == "quest")
    9998        {
    10099            if(status == "start")
    101             {
    102100                message = "You received a new quest: '" + this->title_ + '\'';
    103             }
    104101            else if(status == "fail")
    105             {
    106102                message = "You failed the quest: '" + this->title_ + '\'';
    107             }
    108103            else if(status == "complete")
    109             {
    110104                message = "You successfully completed the quest: '" + this->title_ + '\'';
    111             }
    112105            else
    113106            {
  • code/trunk/src/modules/questsystem/QuestDescription.h

    r7403 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestDescription.h
    3131    @brief Definition of the QuestDescription class.
     32    @ingroup Questsystem
    3233*/
    3334
     
    4546    /**
    4647    @brief
    47         This class is a description of a QuestItem.
    48         It holds a title and a description.
     48        This class is a description of a QuestItem (@ref orxonox::Quest "Quest" and @ref orxonox::QuestHint "QuestHint").
     49        It holds a title and a description. For quests also messages that are sent, when failing or completing the quest can be added.
    4950
    5051        Creating a QuestDescription through XML goes as follows:
    51 
    5252        @code
    5353        <QuestDescription title="Title" description="Description Text" failMessage="You fail." completeMessage="You win!" />
  • code/trunk/src/modules/questsystem/QuestEffect.cc

    r6417 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestEffect.cc
    3131    @brief Implementation of the QuestEffect class.
    3232*/
     
    6464        A list of all the QuestEffects to be invoked.
    6565    @return
    66         Returns false if there was an error, view console of log for further detail.
     66        Returns false if there was an error, view console or log for further details.
    6767    */
    6868    /*static*/ bool QuestEffect::invokeEffects(PlayerInfo* player, std::list<QuestEffect*> & effects)
     
    7373
    7474        for (std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
    75         {
    7675            check = check && (*effect)->invoke(player);
    77         }
     76
    7877        return check;
    7978    }
  • code/trunk/src/modules/questsystem/QuestEffect.h

    r5781 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestEffect.h
    3131    @brief Definition of the QuestEffect class.
     32    @ingroup Questsystem
    3233*/
    3334
     
    4445    /**
    4546    @brief
    46         Handles QuestEffects for Quests.
    47         QuestEffects are the only way for Quests to have any sideeffects in the game world. They are also the only way for a player to gain, complete or fail Quests.
     47        Handles QuestEffects for @ref orxonox::Quest "Quests".
     48        QuestEffects are one of the ways for @ref orxonox::Quest "Quests" to have any side effects on the game world and for the game world to influence the @ref orxonox::Quest "Quests".
    4849    @author
    4950        Damian 'Mozork' Frick
     
    5859            static bool invokeEffects(PlayerInfo* player, std::list<QuestEffect*> & effects); //!< Invokes all QuestEffects in the list.
    5960
    60 
    6161    };
    6262
  • code/trunk/src/modules/questsystem/QuestEffectBeacon.cc

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestEffectBeacon.cc
    3131    @brief Implementation of the QuestEffectBeacon class.
    3232*/
     
    3737#include "core/XMLPort.h"
    3838#include "core/EventIncludes.h"
     39
     40#include "interfaces/PlayerTrigger.h"
    3941#include "worldentities/pawns/Pawn.h"
    40 #include "interfaces/PlayerTrigger.h"
     42
    4143#include "objects/triggers/MultiTriggerContainer.h"
    4244#include "QuestEffect.h"
     
    5052        Constructor. Registers the object and initializes defaults.
    5153    */
     54    //TODO: Make just BaseObject?
    5255    QuestEffectBeacon::QuestEffectBeacon(BaseObject* creator) : StaticEntity(creator)
    5356    {
     
    99102        Returns true if successfully executed, false if not.
    100103    */
     104    //TODO: Eliminate MultiTriggerContainer stuff, since they are now PlayerTriggers as well.
    101105    bool QuestEffectBeacon::execute(bool bTriggered, BaseObject* trigger)
    102106    {
     
    105109            return false;
    106110        }
    107         if(!(this->isActive())) //!< If the QuestEffectBeacon is inactive it cannot be executed.
     111        if(!(this->isActive())) // If the QuestEffectBeacon is inactive it cannot be executed.
    108112        {
    109113            COUT(4) << "The QuestEffectBeacon is inactive." << std::endl;
     
    115119        Pawn* pawn = NULL;
    116120
    117         //! If the trigger is neither a Playertrigger nor a MultiTrigger (i.e. a MultitriggerContainer) we can do anything with it.
     121        // If the trigger is neither a Playertrigger nor a MultiTrigger (i.e. a MultitriggerContainer) we can do anything with it.
    118122        if(pTrigger == NULL && mTrigger == NULL)
    119123            return false;
     
    122126        if(pTrigger != NULL)
    123127        {
    124             if(!pTrigger->isForPlayer())  //!< The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
     128            if(!pTrigger->isForPlayer())  // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
    125129                return false;
    126130            else
     
    140144        }
    141145
    142         //! Extract the PlayerInfo from the Pawn.
     146        // Extract the PlayerInfo from the Pawn.
    143147        PlayerInfo* player = pawn->getPlayer();
    144148
     
    151155        COUT(4) << "QuestEffectBeacon executed on player: " << player << " ." << std::endl;
    152156
    153         bool check = QuestEffect::invokeEffects(player, this->effects_); //!< Invoke the QuestEffects on the PlayerInfo.
     157        bool check = QuestEffect::invokeEffects(player, this->effects_); // Invoke the QuestEffects on the PlayerInfo.
    154158        if(check)
    155159        {
    156             this->decrementTimes(); //!< Decrement the number of times the beacon can be used.
     160            this->decrementTimes(); // Decrement the number of times the beacon can be used.
    157161            return true;
    158162        }
     
    171175    bool QuestEffectBeacon::setActive(bool activate)
    172176    {
    173         if(this->getTimes() == 0 && activate) //!< A QuestEffectBeacon that can be executed only 0 times is always inactive.
    174         {
    175             return false;
    176         }
     177        if(this->getTimes() == 0 && activate) // A QuestEffectBeacon that can be executed only 0 times is always inactive.
     178            return false;
    177179
    178180        if(activate)
    179181        {
    180         this->status_ = QuestEffectBeaconStatus::Active;
    181         return true;
     182            this->status_ = QuestEffectBeaconStatus::Active;
     183            return true;
    182184        }
    183185
     
    194196    bool QuestEffectBeacon::decrementTimes(void)
    195197    {
    196         if(!(this->isActive())) //!< The QuestEffectBeacon mus be active to decrement the number of times it can be executed.
    197         {
    198             return false;
    199         }
    200         if(this->getTimes() == INFINITE_TIME) //!< If times is infinity the QuestEffectBeacon can be executed an infinite number fo times.
    201         {
     198        if(!(this->isActive())) // The QuestEffectBeacon mus be active to decrement the number of times it can be executed.
     199            return false;
     200
     201        if(this->getTimes() == INFINITE_TIME) // If times is infinity the QuestEffectBeacon can be executed an infinite number fo times.
    202202            return true;
    203         }
    204 
    205         this->times_ = this->times_ - 1; //!< Decrement number of times the QuestEffectBeacon can be executed.
    206         if(this->getTimes() == 0) //!< Set the QuestEffectBeacon to inactive when the number of times it can be executed is reduced to 0.
    207         {
     203
     204        this->times_ = this->times_ - 1; // Decrement number of times the QuestEffectBeacon can be executed.
     205        if(this->getTimes() == 0) // Set the QuestEffectBeacon to inactive when the number of times it can be executed is reduced to 0.
    208206            this->status_ = QuestEffectBeaconStatus::Inactive;
    209         }
    210207
    211208        return true;
     
    225222    {
    226223        if(n < 0 && n != INFINITE_TIME)
    227         {
    228             return false;
    229         }
     224            return false;
    230225
    231226        this->times_ = n;
     
    243238    bool QuestEffectBeacon::addEffect(QuestEffect* effect)
    244239    {
    245         if(effect == NULL) //!< NULL-pointers are not well liked here...
     240        //TODO: Replace with assert.
     241        if(effect == NULL) // NULL-pointers are not well liked here...
    246242        {
    247243            COUT(2) << "A NULL-QuestEffect was trying to be added" << std::endl;
     
    269265        {
    270266            if(i == 0)
    271             {
    272267               return *effect;
    273             }
     268
    274269            i--;
    275270        }
  • code/trunk/src/modules/questsystem/QuestEffectBeacon.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestEffectBeacon.h
    3131    @brief Definition of the QuestEffectBeacon class.
     32    @ingroup Questsystem
    3233*/
    3334
     
    4445    namespace QuestEffectBeaconStatus
    4546    {
    46         //! The status of the beacon, can be either active or inactive.
     47        //! The status of the @ref orxonox::QuestEffectBeacon "QuestEffectBeacon", can be either active or inactive.
    4748        enum Value
    4849        {
     
    5455    /**
    5556    @brief
    56         A QuestEffectBeacon is a physical entity in the game which can (under some condition(s)) invoke a number QuestEffects on players meeting the condition(s).
    57         The conditions under which the QuestEffects are invoked on the player are defined by Triggers.
     57        A QuestEffectBeacon is a physical entity in the game which can (under some condition(s)) invoke a number of @ref orxonox::QuestEffect "QuestEffects" on players meeting the condition(s).
     58        The conditions under which the @ref orxonox::QuestEffect "QuestEffects" are invoked on the player are defined by @ref orxonox::Trigger "Triggers" (or really any kind of entity firing events, e.g. @ref oroxnox::EventListener "EventListeners"). The trigger the event originates from, however has to be a @ref orxonox::PlayerTrigger PlayerTrigger.
    5859        A QuestEffectBeacon can be executed a defined number of times.
    59         A QuestEffectBeacon can be inactive or active.
     60        A QuestEffectBeacon can be inactive or active. While inactive it can't be executed.
    6061
    6162        Creating a QuestEffectBeacon through XML goes as follows:
    62 
    6363        @code
    6464        <QuestEffectBeacon times=n> //Where 'n' is eighter a number >= 0, which means the QuestEffectBeacon can be executed n times. Or n = -1, which means the QuestEffectBeacon can be executed an infinite number of times.
  • code/trunk/src/modules/questsystem/QuestHint.cc

    r7403 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestHint.cc
    3131    @brief Implementation of the QuestHint class.
    3232*/
     
    3636#include "core/CoreIncludes.h"
    3737#include "core/XMLPort.h"
     38
     39#include "Quest.h"
     40#include "QuestDescription.h"
    3841#include "QuestManager.h"
    39 #include "QuestDescription.h"
    40 #include "Quest.h"
    4142
    4243namespace orxonox
     
    7172        SUPER(QuestHint, XMLPort, xmlelement, mode);
    7273
    73         QuestManager::getInstance().registerHint(this); //!< Registers the QuestHint with the QuestManager.
     74        QuestManager::getInstance().registerHint(this); // Registers the QuestHint with the QuestManager.
    7475
    7576        COUT(4) << "New QuestHint {" << this->getId() << "} created." << std::endl;
     
    8990    bool QuestHint::isActive(const PlayerInfo* player) const
    9091    {
    91         if(player == NULL) //!< NULL-Pointers are ugly!
     92        //TODO: Replace with asser.
     93        if(player == NULL) // NULL-Pointers are ugly!
    9294        {
    9395            ThrowException(Argument, "The input PlayerInfo* is NULL.");
     
    9597        }
    9698
    97         //! Find the player.
     99        // Find the player.
    98100        std::map<const PlayerInfo*, QuestHintStatus::Value>::const_iterator it = this->playerStatus_.find(player);
    99         if (it != this->playerStatus_.end()) //!< If the player is in the map.
    100         {
     101        if (it != this->playerStatus_.end()) // If the player is in the map.
    101102            return it->second;
    102         }
    103103
    104104        return QuestStatus::Inactive;
     
    115115    bool QuestHint::setActive(PlayerInfo* player)
    116116    {
    117         if(this->quest_->isActive(player)) //!< For a hint to get activated the quest must be active.
     117        if(this->quest_->isActive(player)) // For a hint to get activated the quest must be active.
    118118        {
    119             if(!(this->isActive(player)))  //!< If the hint is already active, activation is pointless.
     119            if(!(this->isActive(player)))  // If the hint is already active, activation is pointless.
    120120            {
    121121                this->playerStatus_[player] = QuestHintStatus::Active;
     
    145145    bool QuestHint::setQuest(Quest* quest)
    146146    {
    147         if(quest == NULL) //!< NULL-Pointer. Again..?
     147        //TODO: Replace with assert.
     148        if(quest == NULL) // NULL-Pointer. Again..?
    148149        {
    149150            COUT(2) << "The input Quest* is NULL." << std::endl;
  • code/trunk/src/modules/questsystem/QuestHint.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestHint.h
    3131    @brief Definition of the QuestHint class.
     32    @ingroup Questsystem
    3233*/
    3334
     
    4243namespace orxonox // tolua_export
    4344{ // tolua_export
     45
    4446    namespace QuestHintStatus
    4547    {
    46         //! The state of the hint.
     48        //! The state of the @ref orxonox::QuestHint "QuestHint".
    4749        enum Value
    4850        {
     
    5456    /**
    5557    @brief
    56         Represents a hint in the game towards completing a Quest.
    57         Consists of title and description (which is stored in a QuestDescription object) in textual form and must belong to a quest.
     58        Represents a hint in the game that gives aid towards completing a @ref orxonox::Quest "Quest".
     59        Consists of title and description (which is stored in a @ref orxonox::QuestDescription "QuestDescription" object) in textual form and must belong to a quest.
    5860        A QuestHint has a defined status (inactive or active, where inactive is default) for each player, which means each a QuestHint exists only once for all players, it doesn't belong to a player, it just has different states for each of them.
    5961
    6062        Creating a QuestHint through XML goes as follows:
    61 
    6263        @code
    6364        <QuestHint id="hintId">
  • code/trunk/src/modules/questsystem/QuestItem.cc

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestItem.cc
    3131    @brief Implementation of the QuestItem class.
    3232*/
     
    3636#include "core/CoreIncludes.h"
    3737#include "core/XMLPort.h"
     38
    3839#include "QuestDescription.h"
    3940
     
    8687    void QuestItem::setId(const std::string & id)
    8788    {
    88         if(id.compare(BLANKSTRING) == 0) //!< Checks whether the id is a valid id.
     89        if(id.compare(BLANKSTRING) == 0) // Checks whether the id is a valid id.
    8990        {
    9091            COUT(2) << "Invalid id. QuestItem id {" << id << "} could not be set." << std::endl;
  • code/trunk/src/modules/questsystem/QuestItem.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestItem.h
    3131    @brief Definition of the QuestItem class.
    32         The QuestItem is the parent class of Quest and QuestHint.
     32        The @ref orxonox::QuestItem "QuestItem" is the parent class of @ref orxonox::Quest "Quest" and @ref orxonox::QuestHint "QuestHint".
     33    @ingroup Questsystem
    3334*/
    3435
     
    4748    /**
    4849    @brief
    49         Functions as a base class for quest classes such as Quest or QuestHint.
    50         Has a unique identifier and a description.
     50        Functions as a base class for quest classes such as @ref orxonox::Quest "Quest" or @ref orxonox::QuestHint "QuestHint".
     51        Has a unique identifier and a @ref orxonox::QuestDescription "QuestDescription".
    5152    @author
    5253        Damian 'Mozork' Frick
  • code/trunk/src/modules/questsystem/QuestListener.cc

    r7163 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestListener.cc
    3131    @brief Implementation of the QuestListener class.
    3232*/
     
    3636#include "core/CoreIncludes.h"
    3737#include "core/XMLPort.h"
     38
    3839#include "Quest.h"
    3940#include "QuestManager.h"
     
    4344    CreateFactory(QuestListener);
    4445
     46    //! Initialization of the static variables for the modes as strings.
     47    /*static*/ const std::string QuestListener::ALL = "all";
     48    /*static*/ const std::string QuestListener::START = "start";
     49    /*static*/ const std::string QuestListener::FAIL = "fail";
     50    /*static*/ const std::string QuestListener::COMPLETE = "complete";
     51
    4552    /**
    4653    @brief
     
    7582
    7683        if(this->quest_ != NULL)
    77             this->quest_->addListener(this); //!< Adds the QuestListener to the Quests list of listeners.
     84            this->quest_->addListener(this); // Adds the QuestListener to the Quests list of listeners.
    7885
    7986        COUT(4) << "QuestListener created for quest: {" << this->quest_->getId() << "} with mode '" << this->getMode() << "'." << std::endl;
     
    9097    /* static */ void QuestListener::advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status)
    9198    {
    92         for (std::list<QuestListener*>::iterator it = listeners.begin(); it != listeners.end(); ++it) //!< Iterate through all QuestListeners
     99        for (std::list<QuestListener*>::iterator it = listeners.begin(); it != listeners.end(); ++it) // Iterate through all QuestListeners
    93100        {
    94101            QuestListener* listener = *it;
    95             if(listener->getMode() == status || listener->getMode() == "all") //!< Check whether the status change affects the give QuestListener.
    96             {
     102            if(listener->getMode() == status || listener->getMode() == QuestListener::ALL) // Check whether the status change affects the give QuestListener.
    97103                listener->execute();
    98             }
    99104        }
    100105    }
     
    110115    bool QuestListener::setQuestId(const std::string & id)
    111116    {
    112         this->quest_ = QuestManager::getInstance().findQuest(id); //!< Find the Quest corresponding to the given questId.
    113 
    114         if(this->quest_ == NULL) //!< If there is no such Quest.
     117        this->quest_ = QuestManager::getInstance().findQuest(id); // Find the Quest corresponding to the given questId.
     118
     119        if(this->quest_ == NULL) // If there is no such Quest.
    115120        {
    116121            ThrowException(Argument, "This is bad! The QuestListener has not found a Quest with a corresponding id..");
     
    131136    bool QuestListener::setMode(const std::string & mode)
    132137    {
    133         if(mode == "all")
    134         {
     138        if(mode == QuestListener::ALL)
    135139            this->mode_ = QuestListenerMode::All;
    136         }
    137         else if(mode == "start")
    138         {
     140        else if(mode == QuestListener::START)
    139141            this->mode_ = QuestListenerMode::Start;
    140         }
    141         else if(mode == "fail")
    142         {
     142        else if(mode == QuestListener::FAIL)
    143143            this->mode_ = QuestListenerMode::Fail;
    144         }
    145         else if(mode == "complete")
    146         {
     144        else if(mode == QuestListener::COMPLETE)
    147145            this->mode_ = QuestListenerMode::Complete;
    148         }
    149146        else
    150147        {
    151148            COUT(2) << "QuestListener with invalid mode '" << mode << "' created. Mode set to 'all'." << std::endl;
    152         this->mode_ = QuestListenerMode::All;
    153         return false;
     149            this->mode_ = QuestListenerMode::All;
     150            return false;
    154151        }
    155152
     
    161158        Get the mode of the QuestListener.
    162159    @return
    163         Return the mode of the QuestListener. Can be eighter 'all', 'start', 'fail' or 'complete'.
     160        Return the mode of the QuestListener. Can be either 'all', 'start', 'fail' or 'complete'.
    164161    */
    165162    std::string QuestListener::getMode(void)
    166163    {
    167         if(this->mode_ == QuestListenerMode::All)
    168         {
    169             return "all";
    170         }
    171         else if(this->mode_ == QuestListenerMode::Start)
    172         {
    173             return "start";
    174         }
    175         else if(this->mode_ == QuestListenerMode::Fail)
    176         {
    177             return "fail";
    178         }
    179         else if(this->mode_ == QuestListenerMode::Complete)
    180         {
    181             return "complete";
    182         }
    183         else
    184         {
    185             COUT(1) << "An unforseen, never to happen, Error has occurred. This is impossible!" << std::endl;
    186             return "";
     164        switch(this->mode_)
     165        {
     166            case QuestListenerMode::All:
     167                return QuestListener::ALL;
     168            case QuestListenerMode::Start:
     169                return QuestListener::START;
     170            case QuestListenerMode::Fail:
     171                return QuestListener::FAIL;
     172            case QuestListenerMode::Complete:
     173                return QuestListener::COMPLETE;
     174            default: // This will never happen.
     175                return QuestListener::ALL;
    187176        }
    188177    }
  • code/trunk/src/modules/questsystem/QuestListener.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestListener.h
    3131    @brief Definition of the QuestListener class.
     32    @ingroup Questsystem
    3233*/
    3334
     
    4546    namespace QuestListenerMode
    4647    {
    47         //! The mode of the QuestListener.
     48        //! The mode of the @ref orxonox::QuestListener "QuestListener".
    4849        enum Value
    4950        {
     
    5758    /**
    5859    @brief
    59         Provides a way to react to the starting, completing and failing of Quests.
     60        Provides a way to react to the starting, completing and failing of @ref orxonox::Quest "Quests".
    6061
    6162        The XML representation goes as follows:
    62         You can use the QuestListener as if it were a Trigger or EventListener, that fires an Event when the status (depending on the set mode) of the given Quest changes.
    63 
    6463        @code
    6564        <BaseObject> // The object that should react to the status change of a Quest.
     
    7170        </BaseObject>
    7271        @endcode
     72
     73        You can use the QuestListener as if it were a @ref orxonox::Trigger "Trigger" or @ref orxonox::EventListener "EventListener", that fires an Event when the status (depending on the set mode) of the given @ref orxonox::Quest "Quest" changes.
    7374    @author
    7475    Damian 'Mozork' Frick
     
    7677    class _QuestsystemExport QuestListener : public BaseObject
    7778    {
    78     public:
    79         QuestListener(BaseObject* creator);
    80         virtual ~QuestListener();
    8179
    82         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestListener object through XML.
     80        public:
     81            QuestListener(BaseObject* creator);
     82            virtual ~QuestListener();
    8383
    84         static void advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status); //!< Makes all QuestListener in the list aware that a certain status change has occured.
     84            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestListener object through XML.
    8585
    86         bool setQuestId(const std::string & id); //!< Sets the questId of the Quest the QuestListener reacts to.
    87         bool setMode(const std::string & mode); //!< Sets the mode of the QuestListener.
     86            static void advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status); //!< Makes all QuestListener in the list aware that a certain status change has occured.
    8887
    89         std::string getMode(void); //!< Get the mode of the QuestListener.
     88            bool setQuestId(const std::string & id); //!< Sets the questId of the Quest the QuestListener reacts to.
     89            bool setMode(const std::string & mode); //!< Sets the mode of the QuestListener.
    9090
    91         const std::string & getQuestId(void);
    92         bool execute(void); //!< Executes the QuestListener, resp. fires an Event.
     91            std::string getMode(void); //!< Get the mode of the QuestListener.
    9392
    94     private:
    95         QuestListenerMode::Value mode_; //!< The mode of the QuestListener.
    96         Quest* quest_; //!< A pointer to the Quest the QuestListener is reacting to.
     93            const std::string & getQuestId(void);
     94            bool execute(void); //!< Executes the QuestListener, resp. fires an Event.
     95
     96        private:
     97            QuestListenerMode::Value mode_; //!< The mode of the QuestListener.
     98            Quest* quest_; //!< A pointer to the Quest the QuestListener is reacting to.
     99
     100            //! Static variables for the modes as strings.
     101            static const std::string ALL;
     102            static const std::string START;
     103            static const std::string FAIL;
     104            static const std::string COMPLETE;
    97105
    98106    };
  • code/trunk/src/modules/questsystem/QuestManager.cc

    r7284 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestManager.cc
    3131    @brief Implementation of the QuestManager class.
    3232*/
     
    3434#include "QuestManager.h"
    3535
    36 #include <CEGUIWindow.h>
    37 
    3836#include "util/Exception.h"
    3937#include "util/ScopedSingletonManager.h"
     38#include "core/command/ConsoleCommand.h"
    4039#include "core/CoreIncludes.h"
    4140#include "core/GUIManager.h"
    4241#include "core/LuaState.h"
    43 #include "core/command/ConsoleCommand.h"
     42
    4443#include "infos/PlayerInfo.h"
    45 #include "overlays/GUIOverlay.h"
    46 
    47 #include "ToluaBindQuestsystem.h"
     44
    4845#include "Quest.h"
    4946#include "QuestHint.h"
    5047#include "QuestItem.h"
     48
     49#include "ToluaBindQuestsystem.h"
    5150
    5251namespace orxonox
     
    6665    {
    6766        RegisterRootObject(QuestManager);
     67
     68        COUT(3) << "QuestManager created." << std::endl;
    6869    }
    6970
     
    7475    QuestManager::~QuestManager()
    7576    {
    76 
     77        COUT(3) << "QuestManager destroyed." << std::endl;
    7778    }
    7879
     
    99100    bool QuestManager::registerQuest(Quest* quest)
    100101    {
    101         if(quest == NULL) //!< Doh! Just as if there were actual quests behind NULL-pointers.
     102        //TODO: Replace with assert.
     103        if(quest == NULL) // Doh! Just as if there were actual quests behind NULL-pointers.
    102104        {
    103105            COUT(2) << "Registration of Quest in QuestManager failed, because inserted Quest-pointer was NULL." << std::endl;
     
    106108
    107109        std::pair<std::map<std::string, Quest*>::iterator,bool> result;
    108         result = this->questMap_.insert( std::pair<std::string,Quest*>(quest->getId(),quest) ); //!< Inserting the Quest.
    109 
    110         if(result.second) //!< If inserting was a success.
     110        result = this->questMap_.insert( std::pair<std::string,Quest*>(quest->getId(),quest) ); // Inserting the Quest.
     111
     112        if(result.second) // If inserting was a success.
    111113        {
    112114            quest->setRegistered();
     
    141143    bool QuestManager::registerHint(QuestHint* hint)
    142144    {
    143         if(hint == NULL) //!< Still not liking NULL-pointers.
     145        //TODO: Replace with assert.
     146        if(hint == NULL) // Still not liking NULL-pointers.
    144147        {
    145148            COUT(2) << "Registration of QuestHint in QuestManager failed, because inserted QuestHint-pointer was NULL." << std::endl;
     
    148151
    149152        std::pair<std::map<std::string, QuestHint*>::iterator,bool> result;
    150         result = this->hintMap_.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) ); //!< Inserting the QuestHSint.
    151 
    152         if(result.second) //!< If inserting was a success.
     153        result = this->hintMap_.insert ( std::pair<std::string,QuestHint*>(hint->getId(),hint) ); // Inserting the QuestHSint.
     154
     155        if(result.second) // If inserting was a success.
    153156        {
    154157            hint->setRegistered();
     
    185188    Quest* QuestManager::findQuest(const std::string & questId)
    186189    {
    187         if(questId.compare(BLANKSTRING) == 1) //!< Check vor validity of the given id.
    188         {
     190        if(questId.compare(BLANKSTRING) == 1) // Check vor validity of the given id.
    189191            ThrowException(Argument, "Invalid questId.");
    190         }
    191192
    192193        Quest* quest;
    193194        std::map<std::string, Quest*>::iterator it = this->questMap_.find(questId);
    194         if (it != this->questMap_.end()) //!< If the Quest is registered.
    195         {
     195        if (it != this->questMap_.end()) // If the Quest is registered.
    196196            quest = it->second;
    197         }
    198197        else
    199198        {
     
    203202
    204203        return quest;
    205 
    206204    }
    207205
     
    219217    QuestHint* QuestManager::findHint(const std::string & hintId)
    220218    {
    221         if(hintId.compare(BLANKSTRING) == 1) //!< Check vor validity of the given id.
    222         {
     219        if(hintId.compare(BLANKSTRING) == 1) // Check vor validity of the given id.
    223220            ThrowException(Argument, "Invalid hintId.");
    224         }
    225221
    226222        QuestHint* hint;
    227223        std::map<std::string, QuestHint*>::iterator it = this->hintMap_.find(hintId);
    228         if (it != this->hintMap_.end()) //!< If the QuestHint is registered.
    229         {
     224        if (it != this->hintMap_.end()) // If the QuestHint is registered.
    230225            hint = it->second;
    231         }
    232226        else
    233227        {
     
    237231
    238232        return hint;
    239 
    240     }
    241 
    242     int QuestManager::getNumParentQuests(PlayerInfo* player)
     233    }
     234
     235    /**
     236    @brief
     237        Get the number of Quests the input player has, that are root quests.
     238    @param player
     239        The player.
     240    @return
     241        Returns the number of Quests the input player has, that are root quests.
     242    */
     243    int QuestManager::getNumRootQuests(PlayerInfo* player)
    243244    {
    244245        int numQuests = 0;
     
    251252    }
    252253
    253     Quest* QuestManager::getParentQuest(PlayerInfo* player, int index)
     254    /**
     255    @brief
     256        Get the index-th root quest of the input player.
     257    @param player
     258        The player.
     259    @param index
     260        The index of the root quest.
     261    @return
     262        Returns the index-th root quest of the input player.
     263    */
     264    Quest* QuestManager::getRootQuest(PlayerInfo* player, int index)
    254265    {
    255266        for(std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)
     
    261272    }
    262273
     274    /**
     275    @brief
     276        Get the number of sub-quest of an input Quest for the input player.
     277    @param quest
     278        The quest to get the sub-quests of.
     279    @param player
     280        The player.
     281    @return
     282        Returns the number of sub-quest of an input Quest for the input player.
     283    */
    263284    int QuestManager::getNumSubQuests(Quest* quest, PlayerInfo* player)
    264285    {
     
    273294    }
    274295
     296    /**
     297    @brief
     298        Get the index-th sub-quest of the input Quest for the input player.
     299    @param quest
     300        The Quest to get the sub-quest of.
     301    @param player
     302        The player.
     303    @param index
     304        The index of the sub-quest.
     305    */
    275306    Quest* QuestManager::getSubQuest(Quest* quest, PlayerInfo* player, int index)
    276307    {
     
    284315    }
    285316
     317    /**
     318    @brief
     319        Get the number of QuestHints of the input Quest for the input player.
     320    @param quest
     321        The quest to get the hints of.
     322    @param player
     323        The player.
     324    @return Returns the number of QuestHints of the input Quest for the input player.
     325    */
    286326    int QuestManager::getNumHints(Quest* quest, PlayerInfo* player)
    287327    {
     
    296336    }
    297337
     338    /**
     339    @brief
     340        Get the index-th QuestHint of the input Quest for the input player.
     341    @param quest
     342        The Quest to get the QuestHint of.
     343    @param player
     344        The player.
     345    @param index
     346        The index of the QuestHint.
     347    */
    298348    QuestHint* QuestManager::getHints(Quest* quest, PlayerInfo* player, int index)
    299349    {
     
    307357    }
    308358
     359    /**
     360    @brief
     361        Get the QuestDescription of the input Quest.
     362    @param item
     363        The Quest to get the QuestDescription of.
     364    @return
     365        Return a pointer ot the QuestDescription of the input Quest.
     366    */
    309367    QuestDescription* QuestManager::getDescription(Quest* item)
    310368    {
     
    312370    }
    313371
     372    /**
     373    @brief
     374        Get the QuestDescription of the input QuestHint.
     375    @param item
     376        The QuestHint to get the QuestDescription of.
     377    @return
     378        Returns a pointer to the QuestDescription of the input QuestHint.
     379    */
    314380    QuestDescription* QuestManager::getDescription(QuestHint* item)
    315381    {
  • code/trunk/src/modules/questsystem/QuestManager.h

    r7163 r7456  
    2828
    2929/**
    30     @file
     30    @file QuestManager.h
    3131    @brief Definition of the QuestManager class.
     32    @ingroup Questsystem
    3233*/
    3334
     
    4445#include "core/OrxonoxClass.h"
    4546
    46 // tolua_begin
    47 namespace orxonox
    48 {
     47namespace orxonox  // tolua_export
     48{  // tolua_export
    4949    /**
    5050    @brief
    51         Is a Singleton and manages Quests, by registering every Quest/QuestHint (through registerX()) and making them globally accessible (through findX()).
    52         Quests (and QuestHints) are registered in the QuestManager with their id, and can be accessed in the same way.
     51        Is a Singleton and manages @ref orxonox::Quest "Quests", by registering every @ref orxonox::Quest "Quest" / @ref orxonox::QuestHint "QuestHint" (through registerX()) and making them globally accessible (through findX()).
     52        @ref orxonox::Quest "Quests" (and @ref orxonox::QuestHint 2) are registered in the QuestManager with their id, and can be accessed in the same way.
    5353    @author
    5454        Damian 'Mozork' Frick
    5555    */
    56     class _QuestsystemExport QuestManager
    57 // tolua_end
     56    class _QuestsystemExport QuestManager  // tolua_export
    5857        : public Singleton<QuestManager>, public orxonox::OrxonoxClass
    5958    { // tolua_export
     
    6564            virtual ~QuestManager();
    6665
    67             //! Returns a reference to the single instance of the Quest Manager.
     66            //! Returns a reference to the single instance of the QuestManager.
    6867            static QuestManager& getInstance() { return Singleton<QuestManager>::getInstance(); } // tolua_export
    6968
    7069            // tolua_begin
    71             int getNumParentQuests(orxonox::PlayerInfo* player);
    72             Quest* getParentQuest(orxonox::PlayerInfo* player, int index);
     70            int getNumRootQuests(orxonox::PlayerInfo* player); //!< Get the number of Quests the input player has, that are root quests.
     71            Quest* getRootQuest(orxonox::PlayerInfo* player, int index); //!< Get the index-th root quest of the input player.
    7372
    74             int getNumSubQuests(Quest* quest, orxonox::PlayerInfo* player);
    75             Quest* getSubQuest(Quest* quest, orxonox::PlayerInfo* player, int index);
     73            int getNumSubQuests(Quest* quest, orxonox::PlayerInfo* player); //!< Get the number of sub-quest of an input Quest for an input player.
     74            Quest* getSubQuest(Quest* quest, orxonox::PlayerInfo* player, int index); //!< Get the index-th sub-quest of the input Quest for the input player.
    7675
    77             int getNumHints(Quest* quest, orxonox::PlayerInfo* player);
    78             QuestHint* getHints(Quest* quest, orxonox::PlayerInfo* player, int index);
     76            int getNumHints(Quest* quest, orxonox::PlayerInfo* player); //!< Get the number of QuestHints of the input Quest for the input player.
     77            QuestHint* getHints(Quest* quest, orxonox::PlayerInfo* player, int index); //!< Get the index-th QuestHint of the input Quest for the input player.
    7978
    8079            QuestDescription* getDescription(Quest* item);
  • code/trunk/src/modules/questsystem/QuestNotification.cc

    r7403 r7456  
    2626 *
    2727 */
     28
     29/**
     30    @file QuestNotification.cc
     31    @brief Implementation of the QuestNotification class.
     32*/
    2833
    2934#include "QuestNotification.h"
  • code/trunk/src/modules/questsystem/QuestNotification.h

    r7403 r7456  
    2626 *
    2727 */
     28
     29/**
     30    @file QuestNotification.h
     31    @brief Definition of the QuestNotification class.
     32    @ingroup Questsystem
     33*/
    2834
    2935#ifndef _QuestNotification_H__
  • code/trunk/src/modules/questsystem/effects/AddQuest.cc

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file AddQuest.cc
    3131    @brief Implementation of the AddQuest class.
    3232*/
     
    3434#include "AddQuest.h"
    3535
     36#include "core/CoreIncludes.h"
     37#include "core/XMLPort.h"
    3638#include "util/Exception.h"
    37 #include "core/CoreIncludes.h"
     39
     40#include "questsystem/Quest.h"
    3841#include "questsystem/QuestManager.h"
    39 #include "questsystem/Quest.h"
    4042
    4143namespace orxonox
     
    8183    bool AddQuest::invoke(PlayerInfo* player)
    8284    {
    83         if(player == NULL) //!< Null-pointers are badass.
     85        //TODO: Replace with assert?
     86        if(player == NULL) // Null-pointers are badass.
    8487        {
    8588            COUT(2) << "Input player is NULL." << std::endl;
     
    9396            Quest* quest = QuestManager::getInstance().findQuest(this->getQuestId());
    9497            if(quest == NULL || !quest->start(player))
    95             {
    9698               return false;
    97             }
    9899        }
    99100        catch(const orxonox::Exception& ex)
  • code/trunk/src/modules/questsystem/effects/AddQuest.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file AddQuest.h
    3131    @brief Definition of the AddQuest class.
     32    @ingroup QuestEffects
    3233*/
    3334
     
    4243    /**
    4344    @brief
    44         Adds a Quest, resp. changes the quests status to active for the player invoking the Quest.
     45        Adds a @ref orxonox::Quest "Quest", resp. changes the @ref orxonox::Quest "Quests" status to active for the player invoking the @ref orxonox::Quest "Quest".
    4546
    46         Creating a AddQuest through XML goes as follows:
    47 
     47        Creating an AddQuest through XML goes as follows:
    4848        @code
    4949        <AddQuest questId="id" />  //Where id identifies the Quest that should be added.
  • code/trunk/src/modules/questsystem/effects/AddQuestHint.cc

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file AddQuestHint.cc
    3131    @brief Implementation of the AddQuestHint class.
    3232*/
     
    3434#include "AddQuestHint.h"
    3535
    36 #include "util/Exception.h"
    3736#include "core/CoreIncludes.h"
    3837#include "core/XMLPort.h"
     38#include "util/Exception.h"
     39
     40#include "questsystem/QuestHint.h"
    3941#include "questsystem/QuestManager.h"
    4042#include "questsystem/QuestItem.h"
    41 #include "questsystem/QuestHint.h"
    4243
    4344namespace orxonox
     
    105106    bool AddQuestHint::invoke(PlayerInfo* player)
    106107    {
    107         if(player == NULL) //!< NULL-pointers are evil!
     108        //TODO: Replace with assert?
     109        if(player == NULL) // NULL-pointers are evil!
    108110        {
    109111            COUT(2) << "The input player is NULL." << std::endl;
     
    117119            QuestHint* hint = QuestManager::getInstance().findHint(this->hintId_);
    118120            if(hint == NULL || !hint->setActive(player))
    119             {
    120121                return false;
    121             }
    122122        }
    123123        catch(const Exception& e)
  • code/trunk/src/modules/questsystem/effects/AddQuestHint.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file AddQuestHint.h
    3131    @brief Definition of the AddQuestHint class.
     32    @ingroup QuestEffects
    3233*/
    3334
     
    4445    /**
    4546    @brief
    46         Adds a QuestHint, resp. activates the QuestHint of the given id for the player the QuestEffect is invoked on.
     47        Adds a @ref orxonox::QuestHint "QuestHint", resp. activates the @ref orxonox::QuestHint "QuestHint" of the given id for the player the QuestEffect is invoked on.
    4748
    4849        Creating a AddQuestHint through XML goes as follows:
    49 
    5050        @code
    5151        <AddQuestHint hintId="id" />  //Where id identifies the QuestHint that should be added.
  • code/trunk/src/modules/questsystem/effects/AddReward.cc

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file AddReward.cc
    3131    @brief Implementation of the AddReward class.
    3232*/
     
    3636#include "core/CoreIncludes.h"
    3737#include "core/XMLPort.h"
     38
    3839#include "interfaces/Rewardable.h"
    3940
     
    5758    AddReward::~AddReward()
    5859    {
     60
    5961    }
    6062
     
    8587        {
    8688            if(i == 0)
    87             {
    8889               return *reward;
    89             }
    9090            i--;
    9191        }
     
    107107        bool check = true;
    108108        for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward )
    109         {
    110109            check = check && (*reward)->reward(player);
    111         }
    112110
    113111        COUT(4) << "Rewardable successfully added to player." << player << " ." << std::endl;
  • code/trunk/src/modules/questsystem/effects/AddReward.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file AddReward.h
    3131    @brief Definition of the AddReward class.
     32    @ingroup QuestEffects
    3233*/
    3334
     
    4445    /**
    4546    @brief
    46         Adds a list of Rewardables to a player.
     47        Adds a list of @ref orxonox::Rewardable "Rewardables" to a player.
    4748
    4849        Creating a AddReward through XML goes as follows:
    49 
    5050        @code
    5151        <AddReward>
  • code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.cc

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file ChangeQuestStatus.cc
    3131    @brief Implementation of the ChangeQuestStatus class.
     32    @ingroup QuestEffects
    3233*/
    3334
     
    3637#include "core/CoreIncludes.h"
    3738#include "core/XMLPort.h"
     39
    3840#include "questsystem/QuestItem.h"
    3941
     
    5557    ChangeQuestStatus::~ChangeQuestStatus()
    5658    {
     59
    5760    }
    5861
  • code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file ChangeQuestStatus.h
    3131    @brief Definition of the ChangeQuestStatus class.
     32    @ingroup QuestEffects
    3233*/
    3334
     
    4445    /**
    4546    @brief
    46         A QuestEffect which changes the status of a specified Quest for the player invoking the QuestEffect.
     47        A QuestEffect which changes the status of a specified @ref orxonox::Quest "Quest" for the player invoking the QuestEffect.
    4748    @author
    4849        Damian 'Mozork' Frick
  • code/trunk/src/modules/questsystem/effects/CompleteQuest.cc

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file CompleteQuest.cc
    3131    @brief Implementation of the CompleteQuest class.
    3232*/
     
    3636#include "core/CoreIncludes.h"
    3737#include "core/XMLPort.h"
     38
     39#include "questsystem/Quest.h"
    3840#include "questsystem/QuestManager.h"
    39 #include "questsystem/Quest.h"
    4041
    4142namespace orxonox
     
    5859    CompleteQuest::~CompleteQuest()
    5960    {
     61
    6062    }
    6163
     
    8183    bool CompleteQuest::invoke(PlayerInfo* player)
    8284    {
    83         if(player == NULL) //!< You know, what we think of NULL-pointers...
     85        //TODO: Replace with assert?
     86        if(player == NULL) // You know, what we think of NULL-pointers...
    8487        {
    8588            COUT(2) << "Input player is NULL." << std::endl;
     
    9598            quest = QuestManager::getInstance().findQuest(this->getQuestId());
    9699            if(quest == NULL || !quest->complete(player))
    97             {
    98100               return false;
    99             }
    100101        }
    101102        catch(const Exception& e)
  • code/trunk/src/modules/questsystem/effects/CompleteQuest.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file CompleteQuest.h
    3131    @brief Definition of the CompleteQuest class.
     32    @ingroup QuestEffects
    3233*/
    3334
     
    4243    /**
    4344    @brief
    44         Completes a Quest (with a specified id) for the player invoking the QuestEffect.
     45        Completes a @ref orxonox::Quest "Quest" (with a specified id) for the player invoking the QuestEffect.
    4546
    4647        Creating a CompleteQuest through XML goes as follows:
    47 
    4848        @code
    4949        <CompleteQuest questId="id" />  //Where id identifies the Quest that should be completed.
  • code/trunk/src/modules/questsystem/effects/FailQuest.cc

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file FailQuest.cc
    3131    @brief Implementation of the FailQuest class.
    3232*/
     
    3636#include "core/CoreIncludes.h"
    3737#include "core/XMLPort.h"
     38
     39#include "questsystem/Quest.h"
    3840#include "questsystem/QuestManager.h"
    39 #include "questsystem/Quest.h"
    4041
    4142namespace orxonox
     
    5859    FailQuest::~FailQuest()
    5960    {
     61
    6062    }
    6163
     
    6870        SUPER(FailQuest, XMLPort, xmlelement, mode);
    6971
    70         COUT(4) << "New FailQUest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
     72        COUT(4) << "New FailQuest, with target Quest {" << this->getQuestId() << "}, created." << std::endl;
    7173    }
    7274
     
    8183    bool FailQuest::invoke(PlayerInfo* player)
    8284    {
    83         if(player == NULL) //!< We don't know what to do with no player.
     85        //TODO: Replace with assert?
     86        if(player == NULL) // We don't know what to do with no player.
    8487        {
    8588            COUT(2) << "Input player is NULL." << std::endl;
     
    9497            quest = QuestManager::getInstance().findQuest(this->getQuestId());
    9598            if(quest == NULL || !quest->fail(player))
    96             {
    9799               return false;
    98             }
    99100        }
    100101        catch(const Exception& e)
  • code/trunk/src/modules/questsystem/effects/FailQuest.h

    r7401 r7456  
    2828
    2929/**
    30     @file
     30    @file FailQuest.h
    3131    @brief Definition of the FailQuest class.
     32    @ingroup QuestEffects
    3233*/
    3334
     
    4243    /**
    4344    @brief
    44         Fails a quest (with a specified id) for the player invoking the QuestEffect.
     45        Fails a @ref orxonox::Quest "Quest" (with a specified id) for the player invoking the QuestEffect.
    4546
    4647        Creating a FailQuest through XML goes as follows:
    47 
    4848        @code
    4949        <FailQuest questId="id" />  //Where id identifies the Quest that should be failed.
Note: See TracChangeset for help on using the changeset viewer.