Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Presentation_HS17_merge/src/modules/dialog/DialogManager.cc @ 11750

Last change on this file since 11750 was 11750, checked in by landauf, 6 years ago

[Dialog_HS17] cleanup XMLPort collection getters

File size: 2.2 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      ...
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "DialogManager.h"
30#include "core/CoreIncludes.h"
31#include "core/singleton/ScopedSingletonIncludes.h"
32#include <string>
33
34namespace orxonox {
35        ManageScopedSingleton(DialogManager, ScopeID::ROOT, false);
36       
37
38       
39        DialogManager::DialogManager()
40        {
41                this->currentTalk_ = nullptr;
42        }
43
44        void DialogManager::setDialog(Dialog* dialog)
45        {
46                this->currentTalk_ = dialog;
47                answerIds_ = &currentTalk_->getAnswerIds();
48        }
49
50        //from here onward funcionality for lua axports
51
52    std::string DialogManager::getQuestion()
53    {
54        return this->currentTalk_->getQuestionString();
55    }
56
57    int DialogManager::getSize()
58    {   
59        return this->answerIds_->size();
60    }
61
62    std::string DialogManager::getAnswer(int index)
63    {
64        return this->currentTalk_->getAnswerString(this->answerIds_->at(index));
65    }
66       
67    std::string DialogManager::getPerson()
68    {
69        return this->currentTalk_->getName();
70    }
71
72    bool DialogManager::endtest(int index)
73    {   
74        if(this->answerIds_->empty())
75        {
76            return true;
77        }
78        else 
79        {
80            return this->currentTalk_->ending(this->answerIds_->at(index));
81        }
82
83    }
84
85    void DialogManager::update(int index)
86    {
87        this->currentTalk_->update(answerIds_->at(index));
88        answerIds_ = &this->currentTalk_->getAnswerIds();
89    }
90}
Note: See TracBrowser for help on using the repository browser.