Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 4, 2017, 4:11:36 PM (8 years ago)
Author:
rrogge
Message:

Buttons

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Dialogue_FS17/src/modules/dialogue/NextQuestion.cc

    r11406 r11413  
    1 #include <vector>
     1//#include <vector>
    22#include <string>
    33#include "core/CoreIncludes.h"
     
    1919         DialogueManager* d = new DialogueManager(context);
    2020       
    21 
    2221    }
    2322
     
    3231
    3332       
    34         //
     33        bool NextQuestion::addposQuestion(NextQuestion* nq){
     34               
     35                possibleQuestions.push_back(nq);
     36                return true;
     37        }
    3538
     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; }
    3648       
    37         //XML and Event shit
     49        //XML and Event stuff
    3850        void NextQuestion::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    3951    {
     
    4153
    4254        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       
    4359    }
    4460        bool NextQuestion::execute(bool bTriggered, BaseObject* trigger)
     
    5773               
    5874        m.setquestion(question);
     75        m.setanswers1(a1);
     76        m.setanswers2(a2);
    5977        orxout() << " 1 " << endl;
    6078
     
    7189        XMLPortEventSink(NextQuestion, BaseObject, "execute", execute, xmlelement, mode);
    7290    }
    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;
    77105        }
    78106
    79         vector<std::string> NextQuestion::getanswers(void){
    80                 return options;
     107        std::string NextQuestion::getanswers2(void){
     108                return a2;
    81109        }
    82110
    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
    86122
    87123}
Note: See TracChangeset for help on using the changeset viewer.