Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 10, 2008, 4:19:44 PM (15 years ago)
Author:
dafrick
Message:

Merged questsystem3.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/objects/quest/QuestDescription.h

    r2371 r2385  
    2929/**
    3030    @file QuestDescription.h
    31     @brief
    32     Definition of the QuestDescription class.
     31    @brief Definition of the QuestDescription class.
    3332*/
    3433
     
    5251        Creating a QuestDescription through XML goes as follows:
    5352       
    54         <QuestDescription title="Title" description="Description Text" />
     53        <QuestDescription title="Title" description="Description Text" failMessage="You fail." completeMessage="You win!" />
    5554    @author
    5655        Damian 'Mozork' Frick
     
    6463            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a QuestDescription object through XML.
    6564
    66         /**
    67         @brief Returns the title.
    68         @return Returns a string containing the title of the QuestDescription.
    69         */
     65            /**
     66            @brief Returns the title.
     67            @return Returns a string containing the title of the QuestDescription.
     68            */
    7069            inline const std::string & getTitle(void) const
    7170                { return this->title_; }
    7271       
    73         /**
    74         @brief Returns the description text.
    75         @return Returns a string containing the description text of the QuestDescription.
    76         */
     72            /**
     73            @brief Returns the description text.
     74            @return Returns a string containing the description text of the QuestDescription.
     75            */
    7776            inline const std::string & getDescription(void) const
    7877                { return this->description_; }
     78       
     79            /**
     80            @brief Returns the fail message.
     81            @return Returns a string containing the fail message of the QuestDescription.
     82            */
     83            inline const std::string & getFailMessage(void) const
     84                { return this->failMessage_; }
     85       
     86            /**
     87            @brief Returns the complete message.
     88            @return Returns a string containing the complete message of the QuestDescription.
     89            */
     90            inline const std::string & getCompleteMessage(void) const
     91                { return this->completeMessage_; }
     92       
     93            /**
     94            @brief Sends a Notification displaying that a QuestHint was added.
     95            @return Returns true if successful.
     96            */
     97            inline bool sendAddHintNotification(void) const
     98                { return notificationHelper("hint", ""); }
     99       
     100            /**
     101            @brief Sends a Notification displaying that a Quest was added.
     102            @return Returns true if successful.
     103            */
     104            inline bool sendAddQuestNotification(void) const
     105                { return notificationHelper("quest", "start"); }
     106       
     107            /**
     108            @brief Sends a Notification displaying that a Quest was failed.
     109            @return Returns true if successful.
     110            */
     111            inline bool sendFailQuestNotification(void) const
     112                { return notificationHelper("quest", "fail"); }
     113       
     114            /**
     115            @brief Sends a Notification displaying that a Quest was completed.
     116            @return Returns true if successful.
     117            */
     118            inline bool sendCompleteQuestNotification(void) const
     119                { return notificationHelper("quest", "complete"); }
    79120
    80121        private:
    81122            std::string title_; //!< The title.
    82123            std::string description_; //!< The description.
     124            std::string failMessage_; //!< The message displayed when the Quest is failed.
     125            std::string completeMessage_; //!< The message displayed when the Quest is completed.
     126
     127            bool notificationHelper(const std::string & item, const std::string & status) const; //!< Helper for sending QuestDescriptions as Notifications.
    83128
    84129            /**
     
    89134                { this->title_ = title; }
    90135               
    91         /**
     136            /**
    92137            @brief Sets the description text.
    93138            @param description The description text to be set.
     
    96141                { this->description_ = description; }
    97142
     143            /**
     144            @brief Sets the fail message.
     145            @param message The fail message to be set.
     146            */
     147            inline void setFailMessage(const std::string & message)
     148                { this->failMessage_ = message; }
     149               
     150            /**
     151            @brief Sets the complete message.
     152            @param message The complete message to be set.
     153            */
     154            inline void setCompleteMessage(const std::string & message)
     155                { this->completeMessage_ = message; }
     156
    98157    };
    99158
Note: See TracChangeset for help on using the changeset viewer.