Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 20, 2018, 12:09:09 AM (7 years ago)
Author:
landauf
Message:

tabs → spaces

File:
1 edited

Legend:

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

    r11781 r11782  
    4444namespace orxonox
    4545{
    46                 /**
    47         @brief
     46    /**
     47    @brief
    4848    class containing core of one dialog with one npc
    4949
     
    5151    it realizes a state machine with the question beeing the states and the answers beeing the connections, it has a current state and
    5252    can be commanded to go to the next state according to a given answer
    53         */
     53    */
    5454
    55         class _DialogExport Dialog : public BaseObject
    56         {
    57                 public:
    58                         Dialog(Context* context);
     55    class _DialogExport Dialog : public BaseObject
     56    {
     57        public:
     58            Dialog(Context* context);
    5959
    60                         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    61                         virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
     60            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
     61            virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
    6262
    63                         void setName(const std::string& name);  //xmlPort-Funktion, sets Namen
    64                         const std::string& getName() const;     //xmlPort-Funktion, returns Namen
     63            void setName(const std::string& name); //xmlPort-Funktion, sets Namen
     64            const std::string& getName() const; //xmlPort-Funktion, returns Namen
    6565
    66                         void setCurrentQuestionId(const std::string& questionId);       //xmlPort-Funktion, sets string id of current question
    67                         const std::string& getCurrentQuestionId() const;        //xmlPort-Funktion, returns id of current question
     66            void setCurrentQuestionId(const std::string& questionId); //xmlPort-Funktion, sets string id of current question
     67            const std::string& getCurrentQuestionId() const; //xmlPort-Funktion, returns id of current question
    6868
    69                         void addQuestion(Question* question); //xmlPort-Funktion, adds question to map
    70                         Question* getQuestion(unsigned int index) const; //xmlPort-Funktion
     69            void addQuestion(Question* question); //xmlPort-Funktion, adds question to map
     70            Question* getQuestion(unsigned int index) const; //xmlPort-Funktion
    7171
    72                         void addAnswer(Answer* answer); //xmlPort-Funktion, adds answer to map
    73                         Answer* getAnswer(unsigned int index) const; //xmlPort-Funktion
     72            void addAnswer(Answer* answer); //xmlPort-Funktion, adds answer to map
     73            Answer* getAnswer(unsigned int index) const; //xmlPort-Funktion
    7474
    75                         /**
    76                 @brief
    77                     returns a pointer to the array of answers belonging to the current question for use in dialogManager
     75            /**
     76            @brief
     77                returns a pointer to the array of answers belonging to the current question for use in dialogManager
    7878
    79                 @return
    80                     pointer to answerId array of question
    81                 */
    82                         const std::vector<std::string>& getAnswerIds() const;
     79            @return
     80                pointer to answerId array of question
     81            */
     82            const std::vector<std::string>& getAnswerIds() const;
    8383
    84                         /**
    85                 @brief
    86                     function called when the trigger object defined in the xml file sets to triggered
     84            /**
     85            @brief
     86                function called when the trigger object defined in the xml file sets to triggered
    8787
    88                 @param bTriggered
    89                     needs to be set like this for correctness
    90                 @param trigger
    91                     needs to be set like this for correctness
    92                 @return
    93                         not really used
    94                 */
    95                         bool execute(bool bTriggered, BaseObject* trigger);
     88            @param bTriggered
     89                needs to be set like this for correctness
     90            @param trigger
     91                needs to be set like this for correctness
     92            @return
     93                not really used
     94            */
     95            bool execute(bool bTriggered, BaseObject* trigger);
    9696
    97                         /**
    98                 @brief
    99                     updates the current Dialog according to the id of a given answer, by setting currentQuestionId to the next one
     97            /**
     98            @brief
     99                updates the current Dialog according to the id of a given answer, by setting currentQuestionId to the next one
    100100
    101                 @param givenAnswerId
    102                         id of the answer given by player
    103                 */
    104                         void update(const std::string& givenAnswerId);
     101            @param givenAnswerId
     102                id of the answer given by player
     103            */
     104            void update(const std::string& givenAnswerId);
    105105
    106                         /**
    107                 @brief
    108                     tests if there is a next question for the given answerId
     106            /**
     107            @brief
     108                tests if there is a next question for the given answerId
    109109
    110                 @param givenAnswerId
    111                                 id of the answer given by player
    112                 @return
    113                         true if there is no more Question to the given answerId
    114                 */
    115                         bool ending(const std::string& givenAnswerId);
     110            @param givenAnswerId
     111                id of the answer given by player
     112            @return
     113                true if there is no more Question to the given answerId
     114            */
     115            bool ending(const std::string& givenAnswerId);
    116116
    117                         /**
    118                 @brief
    119                     gives the text of the npc in the current state
     117            /**
     118            @brief
     119                gives the text of the npc in the current state
    120120
    121                 @return
    122                         sting with npc text
    123                 */
    124                         const std::string& getQuestionString();
     121            @return
     122                sting with npc text
     123            */
     124            const std::string& getQuestionString();
    125125
    126                         /**
    127                 @brief
    128                     returns a sting with the pc answer to the id
     126            /**
     127            @brief
     128                returns a sting with the pc answer to the id
    129129
    130                 @param answerId
    131                         the id of the answer looked for
    132                 @return
    133                         sting with answer
    134                 */
    135                         const std::string& getAnswerString(const std::string& answerId);
     130            @param answerId
     131                the id of the answer looked for
     132            @return
     133                sting with answer
     134            */
     135            const std::string& getAnswerString(const std::string& answerId);
    136136
    137                 private:
    138                         std::string name_;      //!< name of the npc talking
    139                         std::string currentQuestionId_; //!< id of the npc question currently active
    140                         std::map<std::string, Question*> questions_;    //!< a map form the ids of npc textoptions to the objects containing them
    141                         std::map<std::string, Answer*> answers_;        //!< a map form the ids of npc textoptions to the objects containing them
    142         };
     137        private:
     138            std::string name_; //!< name of the npc talking
     139            std::string currentQuestionId_; //!< id of the npc question currently active
     140            std::map<std::string, Question*> questions_; //!< a map form the ids of npc textoptions to the objects containing them
     141            std::map<std::string, Answer*> answers_; //!< a map form the ids of npc textoptions to the objects containing them
     142    };
    143143}
    144144
Note: See TracChangeset for help on using the changeset viewer.