Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 11, 2017, 3:35:50 PM (6 years ago)
Author:
kuchlert
Message:

fertig kommentierte version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Dialog_HS17/src/modules/dialog/Dialog.h

    r11644 r11656  
    1616namespace orxonox
    1717{
     18                /**
     19        @brief
     20    class containing core of one dialog with one npc
     21
     22    this class contains a map of all answerids to answers (player text options) and one of all questionids to questions (npc text options)
     23    it realizes a state machine with the question beeing the states and the answers beeing the connections, it has a current state and
     24    can be commanded to go to the next state according to a given answer
     25        */
     26
    1827        class _DialogExport Dialog : public BaseObject
    1928        {
     
    2433                        virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    2534
    26                         void setName(const std::string& name);  //xmlPort-Funktion, setzt Namen
    27                         const std::string& getName() const;     //xmlPort-Funktion, returnt Namen
     35                        void setName(const std::string& name);  //xmlPort-Funktion, sets Namen
     36                        const std::string& getName() const;     //xmlPort-Funktion, returns Namen
    2837
    29                         void setCurrentQuestionId(const std::string& questionId);       //xmlPort-Funktion, setzt string Id der momentanen Frage
    30                         const std::string& getCurrentQuestionId() const;        //xmlPort-Funktion, gibt Id der momentanen Frage
     38                        void setCurrentQuestionId(const std::string& questionId);       //xmlPort-Funktion, sets string id of current question
     39                        const std::string& getCurrentQuestionId() const;        //xmlPort-Funktion, returns id of current question
    3140
    32                         void addQuestion(Question* question); //xmlPort-Funktion, fuegt Question der Map hinzu
    33                         const Question* getQuestion() const; //xmlPort-Funktion, returnt nullptr
     41                        void addQuestion(Question* question); //xmlPort-Funktion, adds question to map
     42                        const Question* getQuestion() const; //xmlPort-Funktion, returns nullptr
    3443
    35                         void addAnswer(Answer* answer); //xmlPort-Funktion, fuegt Answer der Map hinzu
    36                         const Answer* getAnswer(unsigned int index) const; //xmlPort-Funktion, returnt nullptr
     44                        void addAnswer(Answer* answer); //xmlPort-Funktion, adds answer to map
     45                        const Answer* getAnswer(unsigned int index) const; //xmlPort-Funktion, returns nullptr
    3746
     47                        /**
     48                @brief
     49                    returns a pointer to the array of answers belonging to the current question for use in dialogManager
    3850
    39                         const std::vector<std::string>* getAnswerIds();         // returned Pointer auf Vector mit allen momentanen AntwortenIds
     51                @return
     52                    pointer to answerId array of question
     53                */
     54                        const std::vector<std::string>* getAnswerIds();
    4055
    41                         bool execute(bool bTriggered, BaseObject* trigger); // funktion die aufgerufen wird wenn der im xml verbundene Trigger aktiviert wird
     56                        /**
     57                @brief
     58                    function called when the trigger object defined in the xml file sets to triggered
    4259
    43                         void update(const std::string& givenAnswerId);  //setzt die naechste Frage entsprechend der gegebenen antwortId
     60                @param bTriggered
     61                    needs to be set like this for correctness
     62                @param trigger
     63                    needs to be set like this for correctness
     64                @return
     65                        not really used
     66                */
     67                        bool execute(bool bTriggered, BaseObject* trigger);
    4468
    45                         bool ending(const std::string& givenAnswerId); //ist true falls fuer die gegebene AntwortId keine Frage zur FragenId der Antwort existiert
     69                        /**
     70                @brief
     71                    updates the current Dialog according to the id of a given answer, by setting currentQuestionId to the next one
    4672
    47                         const std::string& getQuestionString(); //gibt string der momentanen Frage
    48                         const std::string& getAnswerString(std::string answerId); //gibt string der zur Id passenden Frage
     73                @param givenAnswerId
     74                        id of the answer given by player
     75                */
     76                        void update(const std::string& givenAnswerId);
     77
     78                        /**
     79                @brief
     80                    tests if there is a next question for the given answerId
     81
     82                @param givenAnswerId
     83                                id of the answer given by player
     84                @return
     85                        true if there is no more Question to the given answerId
     86                */
     87                        bool ending(const std::string& givenAnswerId);
     88
     89                        /**
     90                @brief
     91                    gives the text of the npc in the current state
     92
     93                @return
     94                        sting with npc text
     95                */
     96                        const std::string& getQuestionString();
     97
     98                        /**
     99                @brief
     100                    returns a sting with the pc answer to the id
     101
     102                @param answerId
     103                        the id of the answer looked for
     104                @return
     105                        sting with answer
     106                */
     107                        const std::string& getAnswerString(std::string answerId);
    49108
    50109                private:
    51                         std::string name_;
    52                         std::string currentQuestionId_;
    53                         std::map<std::string, Question*> questions_;
    54                         std::map<std::string, Answer*> answers_;
     110                        std::string name_;      //!< name of the npc talking
     111                        std::string currentQuestionId_; //!< id of the npc question currently active
     112                        std::map<std::string, Question*> questions_;    //!< a map form the ids of npc textoptions to the objects containing them
     113                        std::map<std::string, Answer*> answers_;        //!< a map form the ids of npc textoptions to the objects containing them
    55114        };
    56115}
Note: See TracChangeset for help on using the changeset viewer.