- Timestamp:
- May 4, 2017, 4:11:36 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc
r11406 r11413 1 #include <vector>1 //#include <vector> 2 2 #include <string> 3 3 #include "core/CoreIncludes.h" … … 19 19 DialogueManager* d = new DialogueManager(context); 20 20 21 22 21 } 23 22 … … 32 31 33 32 34 // 33 bool NextQuestion::addposQuestion(NextQuestion* nq){ 34 35 possibleQuestions.push_back(nq); 36 return true; 37 } 35 38 39 const NextQuestion* NextQuestion::getposQuestion(unsigned int i) const 40 { 41 for (NextQuestion* effect : this->possibleQuestions) 42 { 43 if(i == 0) 44 return effect; 45 i--; 46 } 47 return nullptr; } 36 48 37 //XML and Event s hit49 //XML and Event stuff 38 50 void NextQuestion::XMLPort(Element& xmlelement, XMLPort::Mode mode) 39 51 { … … 41 53 42 54 XMLPortParam(NextQuestion, "question", setquestion, getquestion, xmlelement, mode); 55 XMLPortParam(NextQuestion, "a1", setanswers1, getanswers1, xmlelement, mode); 56 XMLPortParam(NextQuestion, "a2", setanswers2, getanswers2, xmlelement, mode); 57 XMLPortObject(NextQuestion, NextQuestion, "possibleQuestions", addposQuestion, getposQuestion, xmlelement, mode); 58 43 59 } 44 60 bool NextQuestion::execute(bool bTriggered, BaseObject* trigger) … … 57 73 58 74 m.setquestion(question); 75 m.setanswers1(a1); 76 m.setanswers2(a2); 59 77 orxout() << " 1 " << endl; 60 78 … … 71 89 XMLPortEventSink(NextQuestion, BaseObject, "execute", execute, xmlelement, mode); 72 90 } 73 /*void NextQuestion::setanswers(std::string option1, std::string option2, std::string option3){ 74 options.at(0)=option1; 75 options.at(1)=option2; 76 options.at(2)=option3; 91 92 93 void NextQuestion::setanswers1(std::string a1){ 94 this->a1=a1; 95 } 96 97 void NextQuestion::setanswers2(std::string a2){ 98 this->a2=a2; 99 } 100 101 102 103 std::string NextQuestion::getanswers1(void){ 104 return a1; 77 105 } 78 106 79 vector<std::string> NextQuestion::getanswers(void){80 return options;107 std::string NextQuestion::getanswers2(void){ 108 return a2; 81 109 } 82 110 83 int NextQuestion::getnumOptions(){ 84 return options.size(); 85 }*/ 111 NextQuestion NextQuestion::compare(){ 112 DialogueManager& m = DialogueManager::getInstance(); 113 if(m.a1clicked()){ 114 return *possibleQuestions[0]; 115 } 116 117 else if(m.a2clicked()){ 118 return *possibleQuestions[1]; 119 } 120 } 121 86 122 87 123 }
Note: See TracChangeset
for help on using the changeset viewer.