Changeset 11611 for code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc
- Timestamp:
- Nov 30, 2017, 9:33:27 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc
r11607 r11611 5 5 #include "Dialog.h" 6 6 #include "Question.h" 7 7 8 8 9 namespace orxonox … … 57 58 void Dialog::addQuestion(Question* question) //fuegt Question der Map hinzu 58 59 { 59 //questions_.emplace(question->getQuestionId(), question->getQuestion());60 this->questions_.insert(make_pair(question->getQuestionId(), question)); 60 61 } 61 62 62 63 void Dialog::addAnswer(Answer* answer) //fuegt Answer der Map hinzu 63 64 { 64 //answers_.emplace(std::make_pair(answer->getAnswerId(), answer->getAnswer()));65 this->answers_.insert(make_pair(answer->getAnswerId(), answer)); 65 66 } 66 67 … … 72 73 } 73 74 74 Answer* Dialog::getAnswer(unsigned int index) const //tolua_export//returned sting der Antwort zur Id.75 Answer* Dialog::getAnswer(unsigned int index) const //returned sting der Antwort zur Id. 75 76 { 76 77 return nullptr; … … 81 82 { 82 83 83 Question question = (questions_.find(this->currentQuestionId_))->second;84 std::vector<std::string> answers = question .getAnswerIds();84 Question* question = (this->questions_.find(this->currentQuestionId_))->second; 85 std::vector<std::string> answers = question->getAnswerIds(); 85 86 return answers; 86 87 } … … 98 99 void Dialog::update(std::string givenAnswer) 99 100 { 100 Answer answer = (answers_.find(givenAnswer))->second;101 this->currentQuestionId_ = answer .getNextQuestion();101 Answer* answer = (answers_.find(givenAnswer))->second; 102 this->currentQuestionId_ = answer->getNextQuestion(); 102 103 } 103 104 104 bool Dialog::ending() // tolua_export //retruned true wenn die Id der Antwort end ist oder keine Antworten auf die frage eingetragen sind105 bool Dialog::ending() //retruned true wenn die Id der Antwort end ist oder keine Antworten auf die frage eingetragen sind 105 106 { 106 107 bool end = false; 107 108 if (this->currentQuestionId_ == "end"){ 108 109 end = true; 109 } else if (( questions_.find(this->currentQuestionId_)->second).getAnswerIds().empty()){110 } else if ((this->questions_.find(this->currentQuestionId_)->second)->getAnswerIds().empty()){ 110 111 end = true; 111 112 }
Note: See TracChangeset
for help on using the changeset viewer.