Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

merged questsystem2 back to trunk

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/objects/quest/Quest.h

    r2096 r2261  
    2626 *
    2727 */
    28 
     28 
     29/**
     30    @file Quest.h
     31    @brief
     32    Definition of the Quest class.
     33   
     34    The Quest is the parent class of LocalQuest and GlobalQuest.
     35*/
     36 
    2937#ifndef _Quest_H__
    3038#define _Quest_H__
     
    3644
    3745#include "core/XMLPort.h"
     46
    3847#include "QuestItem.h"
    3948
     
    4150{
    4251
     52    //!Different states of a Quest.
    4353    enum Enum
    4454    {
     
    5363namespace orxonox {
    5464
    55     class Player; //Forward declaration, remove when fully integrated into the objecthirarchy.
    56 
    5765    /**
    5866    @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).
    61         Each quest exists only once but it has a different status (inactive, active, failed or completed) for each player.
     67        Represents a Quest in the game.
     68        A Quest has a list of subquests and a parentquest (if it is not a rootquest).
     69        Each Quest exists only once but it has a different status (inactive, active, failed or completed) for each player.
     70        A Quest has several hints (QuestHint) that can be unlocked through QuestEffects and then display aid in solving the Quest.
     71        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.
     72       
     73        Quest itself should not be instantiated, if you want to create a quest either go for LocalQuest or GlobalQuest, whichever suits you needs better.
    6274    @author
    6375        Damian 'Mozork' Frick
     
    6981            virtual ~Quest();
    7082
    71             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     83            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Quest object through XML.
    7284
    73             inline Quest* getParentQuest(void) const //!< Returns the parent quest of the quest.
     85            /**
     86            @brief Returns the parentquest of the Quest.
     87            @return Returns a pointer to the parentquest of the Quest.
     88            */
     89            inline Quest* getParentQuest(void) const
    7490                { return this->parentQuest_; }
    75             inline const std::list<Quest*> & getSubQuestList(void) const //!< Returns the list of sub quests.
    76                 { return this->subQuests_; }
    77 
    78             bool isInactive(const Player* player) const; //!< Returns true if the quest status for the specific player is 'inactive'.
    79             bool isActive(const Player* player) const; //!< Returns true if the quest status for the specific player is 'active'.
    80             bool isFailed(const Player* player) const; //!< Returns true if the quest status for the specific player is 'failed'.
    81             bool isCompleted(const Player* player) const; //!< Returns true if the quest status for the specific player is 'completed'.
    82 
    83             bool start(Player* player); //!< Sets a quest to active.
    84             bool fail(Player* player); //!< Fails the quest.
    85             bool complete(Player* player); //!< Completes the quest.
     91               
     92            /**
     93            @brief Returns the list of subquests.
     94            @return Returns a reference to the list of subquests of the quest.
     95            */
     96            inline const std::list<Quest*> & getSubQuestList(void) const
     97                { return this->subQuests_; }
     98                   
     99            /**
     100            @brief Returns the list of all QuestHints of this Quest.
     101            @return Returns a reference to the list of QuestHints of the Quest.
     102            */
     103            inline const std::list<QuestHint*> & getHintsList(void) const
     104                { return this->hints_; }
     105           
     106            bool isInactive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'inactive'.
     107            bool isActive(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'active'.
     108            bool isFailed(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'failed'.
     109            bool isCompleted(const PlayerInfo* player) const; //!< Returns true if the quest status for the specific player is 'completed'.
     110           
     111            bool start(PlayerInfo* player); //!< Sets a Quest to active.
     112            virtual bool fail(PlayerInfo* player) = 0; //!< Fails the Quest.
     113            virtual bool complete(PlayerInfo* player) = 0; //!< Completes the Quest.
    86114
    87115        protected:
    88             void initialize(void); //!< Initialized the object.
     116            virtual bool isStartable(const PlayerInfo* player) const = 0; //!< Checks whether the Quest can be started.
     117            virtual bool isFailable(const PlayerInfo* player) const = 0; //!< Checks whether the Quest can be failed.
     118            virtual bool isCompletable(const PlayerInfo* player) const = 0; //!< Checks whether the Quest can be completed.
    89119
    90             virtual bool isStartable(const Player* player) const = 0; //!< Checks whether the quest can be started.
    91             virtual bool isFailable(const Player* player) const = 0; //!< Checks whether the quest can be failed.
    92             virtual bool isCompletable(const Player* player) const = 0; //!< Checks whether the quest can be completed.
     120            const Quest* getParentQuest(void); //!< Returns the parentquest of the Quest.
     121            const Quest* getSubQuest(unsigned int index) const; //!<Returns the subquest at the given index.
     122            const QuestHint* getHint(unsigned int index) const; //!< Returns the QuestHint at the given index.
     123            const QuestEffect* getFailEffect(unsigned int index) const; //!< Returns the fail QuestEffect at the given index.
     124            const QuestEffect* getCompleteEffect(unsigned int index) const; //!< Returns the complete QuestEffect at the given index.
     125           
     126            /**
     127            @brief Returns the list of fail QuestEffects.
     128            @return Returns a reference to the list of fail QuestEffects.
     129            */
     130            inline std::list<QuestEffect*> & getFailEffectList(void)
     131                { return this->failEffects_; }
     132               
     133            /**
     134            @brief Returns the list of complete QuestEffects.
     135            @return Returns a reference to the list of complete QuestEffects.
     136            */
     137            inline std::list<QuestEffect*> & getCompleteEffectList(void)
     138                { return this->completeEffects_; }
    93139
    94             bool setParentQuest(Quest* quest); //!< Sets the parent quest of the quest.
    95             bool addSubQuest(Quest* quest); //!< Adds a sub quest to the quest.
    96             bool addHint(QuestHint* hint); //!< Add a hint to the list of hints.
    97             bool addFailEffect(QuestEffect* effect);
    98             bool addCompleteEffect(QuestEffect* effect);
     140            virtual questStatus::Enum getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player.
     141            virtual bool setStatus(PlayerInfo* player, const questStatus::Enum & status) = 0; //!< Changes the status for a specific player.
     142           
     143    private:
     144            Quest* parentQuest_; //!< Pointer to the parentquest.
     145            std::list<Quest*> subQuests_; //!< List of all the subquests.
    99146
    100             const Quest* getParentQuest(void);
    101             const Quest* getSubQuests(unsigned int index) const;
    102             const QuestHint* getHints(unsigned int index) const;
    103             const QuestEffect* getFailEffects(unsigned int index) const;
    104             const QuestEffect* getCompleteEffects(unsigned int index) const;
     147            std::list<QuestHint*> hints_; //!< A list of all the QuestHints tied to this Quest.
    105148
    106             virtual questStatus::Enum getStatus(const Player* player) const = 0; //!< Returns the status of the quest for a specific player.
    107             virtual bool setStatus(Player* player, const questStatus::Enum & status) = 0; //!< Changes the status for a specific player.
    108 
    109             Quest* parentQuest_; //!< Pointer to the parent quest.
    110             std::list<Quest*> subQuests_; //!< List of all the sub quests.
    111 
    112             std::list<QuestHint*> hints_; //!< A list of all the hints tied to this quest.
    113 
    114             std::list<QuestEffect*> failEffects_; //!< A list of all effects to be invoked, when the quest has been failed.
    115             std::list<QuestEffect*> completeEffects_; //!< A list of effects to be invoked, when the quest has been completed.
     149            std::list<QuestEffect*> failEffects_; //!< A list of all QuestEffects to be invoked, when the Quest has been failed.
     150            std::list<QuestEffect*> completeEffects_; //!< A list of QuestEffects to be invoked, when the Quest has been completed.
     151           
     152            bool setParentQuest(Quest* quest); //!< Sets the parentquest of the Quest.
     153            bool addSubQuest(Quest* quest); //!< Adds a subquest to the Quest.
     154            bool addHint(QuestHint* hint); //!< Add a QuestHint to the list of QuestHints.
     155            bool addFailEffect(QuestEffect* effect); //!< Adds an QuestEffect to the list of fail QuestEffects.
     156            bool addCompleteEffect(QuestEffect* effect); //!< Adds an QuestEffect to the list of complete QuestEffects.
    116157
    117158    };
Note: See TracChangeset for help on using the changeset viewer.