Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 27, 2017, 4:57:47 PM (7 years ago)
Author:
maxima
Message:

No more compiler errors. XMLPortObjects not yet implemented.

Location:
code/branches/Dialog_HS17/src/modules/dialog
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Dialog_HS17/src/modules/dialog/Answer.cc

    r11579 r11607  
    2626        }
    2727
    28         std::string getAnswerId(){
     28        std::string Answer::getAnswerId(){
    2929                return this->answerId_;
    3030        }
  • code/branches/Dialog_HS17/src/modules/dialog/Answer.h

    r11579 r11607  
     1#ifndef _Answer_H__
     2#define _Answer_H__
     3
    14#include "core/BaseObject.h"
    25#include "core/XMLPort.h"
     6#include "core/CoreIncludes.h"
    37#include <string>
    48
     
    1014                public:
    1115                        Answer(Context* context);
    12                         virtual ~Answer();
     16                //      virtual ~Answer();
    1317                        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    1418
     
    2832        };
    2933}
     34
     35#endif
  • code/branches/Dialog_HS17/src/modules/dialog/AnswerId.cc

    r11579 r11607  
    2020                this->Id_ = Id;
    2121        }
    22         const std::string& AnswerId::getId(){
     22        std::string AnswerId::getId(){
    2323                return this->Id_;
    2424        }
  • code/branches/Dialog_HS17/src/modules/dialog/AnswerId.h

    r11579 r11607  
     1#ifndef _AnswerID_H__
     2#define _AnswerID_H__
     3
    14#include "core/XMLPort.h"
    25#include "core/BaseObject.h"
     6#include "core/CoreIncludes.h"
    37
    48#include <string>
    5 
    6 #pragma once
    79
    810namespace orxonox{
     
    1113                public:
    1214                        AnswerId(Context* context);
    13                         virtual ~AnswerId();
     15                //      virtual ~AnswerId();
    1416                        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    1517
     
    2123        };
    2224}
     25
     26#endif
  • code/branches/Dialog_HS17/src/modules/dialog/CMakeLists.txt

    r11579 r11607  
    1111  FIND_HEADER_FILES
    1212   TOLUA_FILES
    13     DialogManager.h
    14     Dialog.h
    1513  LINK_LIBRARIES
    1614    orxonox
  • code/branches/Dialog_HS17/src/modules/dialog/Dialog.cc

    r11579 r11607  
    33#include "core/XMLPort.h"
    44#include "core/EventIncludes.h"
     5#include "Dialog.h"
     6#include "Question.h"
    57
    68namespace orxonox
     
    2123                XMLPortParam(Dialog, "name", setName, getName, xmlelement, mode);
    2224                XMLPortParam(Dialog, "currentQuestionId", setCurrentQuestionId, getCurrentQuestionId, xmlelement, mode);
    23                 XMLPortObject(Dialog, Question, "Questions", addQuestion, getQuestion, xmlelement,mode);
     25                XMLPortObject(Dialog, Question, "Questions", addQuestion, getQuestion, xmlelement, mode);
    2426                XMLPortObject(Dialog, Answer, "Answers", addAnswer, getAnswer, xmlelement, mode);
    2527        }
     
    5355
    5456
    55         void Dialog::addQuestion(Question question) //fuegt Question der Map hinzu
     57        void Dialog::addQuestion(Question* question) //fuegt Question der Map hinzu
    5658        {
    57                 //questions_.emplace(question.getQuestionId, question);
     59                //questions_.emplace(question->getQuestionId(), question->getQuestion());
    5860        }
    5961
    60         void Dialog::addAnswer(Answer answer) //fuegt Answer der Map hinzu
     62        void Dialog::addAnswer(Answer* answer) //fuegt Answer der Map hinzu
    6163        {
    62                 //answers_.emplace(std::make_pair(answer.getAnswerId, answer));
     64                //answers_.emplace(std::make_pair(answer->getAnswerId(), answer->getAnswer()));
    6365        }
    6466
    65         std::string Dialog::getQuestion() // returned nichts
     67        Question* Dialog::getQuestion(unsigned int index) const // returned nichts
    6668        {
    67                 Question question = (questions_.find(this->currentQuestionId_))->second;
    68                 return question.getQuestion();
     69                return nullptr;
     70                // Question question = (questions_.find(this->currentQuestionId_))->second;
     71                // return question.getQuestion();
    6972        }
    7073
    71         std::string Dialog::getAnswer(std::string answerId) //tolua_export              //returned sting der Antwort zur Id.
     74        Answer* Dialog::getAnswer(unsigned int index) const//tolua_export               //returned sting der Antwort zur Id.
    7275        {
    73                 return (this->answers_.find(answerId))->second.getAnswer();
     76                return nullptr;
     77                // return (this->answers_.find(answerId))->second.getAnswer();
    7478        }
    7579
  • code/branches/Dialog_HS17/src/modules/dialog/Dialog.h

    r11579 r11607  
     1#ifndef _Dialog_H__
     2#define _Dialog_H__
     3
    14#include "core/BaseObject.h"
    25#include "Question.h"
    36#include "Answer.h"
    47#include "core/XMLPort.h"
     8#include "core/CoreIncludes.h"
    59#include "overlays/OrxonoxOverlay.h"
    610
     
    1317                public:
    1418                        Dialog(Context* context);
    15                         virtual ~Dialog();
     19                        // virtual ~Dialog();
    1620                        virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    1721                        virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
     
    2327                        std::string getCurrentQuestionId();
    2428
    25                         void addQuestion(Question question); //fuegt Question der Map hinzu
    26                         void addAnswer(Answer answer); //fuegt Answer der Map hinzu
     29                        void addQuestion(Question* question); //fuegt Question der Map hinzu
     30                        void addAnswer(Answer* answer); //fuegt Answer der Map hinzu
    2731
    28                         std::string getQuestion(); //tolua_export       // returned string der momentanen Frage
    29                         std::string getAnswer(std::string answerId); //tolua_export             //returned sting der Antwort zur Id.
     32                        Question* getQuestion(unsigned int index) const; //tolua_export // returned string der momentanen Frage
     33                        Answer* getAnswer(unsigned int index) const; //tolua_export     // returned string der momentanen Frage
    3034                        std::vector<std::string> getAnswers(); //tolua_export   // returned vector mit allen momentanen AntwortenIds
    3135
    32                         bool execute(bool bTriggered, BaseObject* trigger);
     36                        bool execute(bool bTriggered, BaseObject* trigger);
    3337
    3438                        void update(std::string givenAnswer);   //tolua_export
     
    4448        };
    4549}
     50
     51#endif
  • code/branches/Dialog_HS17/src/modules/dialog/DialogManager.cc

    r11579 r11607  
     1#include "DialogManager.h"
     2#include "core/CoreIncludes.h"
     3#include "core/singleton/ScopedSingletonIncludes.h"
     4
     5namespace orxonox
     6{
     7    ManageScopedSingleton(DialogManager, ScopeID::ROOT, false);
     8
     9    RegisterAbstractClass(DialogManager).inheritsFrom<Listable>();
     10
     11    DialogManager::DialogManager()
     12    {
     13        RegisterObject(DialogManager);
     14
     15        this->currentTalk_ = NULL;
     16    }
     17
     18    void DialogManager::setDialog(Dialog* dialog)
     19        {
     20                this->currentTalk_ = dialog;   
     21        }
     22
     23        const Dialog* DialogManager::getCurrentDialog()
     24        {
     25                return this->currentTalk_;
     26        }
     27       
     28        bool DialogManager::empty()
     29        {
     30                if(this->currentTalk_ == NULL)
     31                {
     32                        return true;
     33                }
     34                else
     35                {
     36                        return false;
     37                }
     38        }
     39}
    140/*#include "core/CoreIncludes.h"
    241#include "core/LuaState.h"
     
    4685        }
    4786} */
    48 
    49 #include "DialogManager.h"
    50 #include "core/CoreIncludes.h"
    51 #include "core/singleton/ScopedSingletonIncludes.h"
    52 
    53 namespace orxonox
    54 {
    55     ManageScopedSingleton(DialogManager, ScopeID::ROOT, false);
    56 
    57     RegisterAbstractClass(DialogManager).inheritsFrom<Listable>();
    58 
    59     DialogManager::DialogManager()
    60     {
    61         RegisterObject(DialogManager);
    62 
    63         this->value_ = 999;
    64     }
    65 }
  • code/branches/Dialog_HS17/src/modules/dialog/DialogManager.h

    r11579 r11607  
    7373
    7474                void setDialog(Dialog* dialog);
    75                 const Dialog& getCurrentDialog();
    76                  bool empty();
     75                const Dialog* getCurrentDialog();
     76                bool empty();
    7777
    7878        private:
  • code/branches/Dialog_HS17/src/modules/dialog/Question.cc

    r11579 r11607  
    1919                XMLPortParam(Question, "Id", setQuestionId, getQuestionId, xmlement, mode);
    2020
    21                 XMLPortObject(Question, AnswerId, "answers", addAnswerId, getAnswerIds, xmlement, mode);
     21                XMLPortObject(Question, AnswerId, "answers", addAnswerId, getAnswerId, xmlement, mode);
    2222        }
    2323
     
    3737        }
    3838
    39         cstd::string Question::getQuestion()
     39        std::string Question::getQuestion()
    4040        {
    4141                return this->question_;
    4242        }
    4343
    44         void Question::addAnswerId(AnswerId answerId)
     44        void Question::addAnswerId(AnswerId* answerId)
    4545        {
    46                 this->answerIds_.push_back(answerId.getId);
     46                this->answerIds_.push_back(answerId->getId());
    4747        }
    4848
     49        AnswerId* Question::getAnswerId(unsigned int index) const
     50        {
     51                return nullptr;
     52        }
    4953
    5054        std::vector<std::string> Question::getAnswerIds()
  • code/branches/Dialog_HS17/src/modules/dialog/Question.h

    r11579 r11607  
     1#ifndef _Question_H__
     2#define _Question_H__
     3
    14#include "core/BaseObject.h"
    25#include "AnswerId.h"
    36#include "core/XMLPort.h"
     7#include "core/CoreIncludes.h"
    48
    59#include <string>
     
    1115                public:
    1216                        Question(Context* context);
    13                         virtual ~Question();
     17                //      virtual ~Question();
    1418                        virtual void XMLPort(Element& xmelement, XMLPort::Mode mode);
    1519
     
    2024                        std::string getQuestion();
    2125
    22                         void addAnswerId(AnswerId answerId); //leer lassen um Dialog zu beenden
     26                        void addAnswerId(AnswerId* answerId); //leer lassen um Dialog zu beenden
     27                        AnswerId* getAnswerId(unsigned int index) const;
    2328
    2429                       
     
    3641        };
    3742}
     43
     44#endif
Note: See TracChangeset for help on using the changeset viewer.