[11749] | 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 | |
---|
[11607] | 29 | #include "DialogManager.h" |
---|
| 30 | #include "core/CoreIncludes.h" |
---|
| 31 | #include "core/singleton/ScopedSingletonIncludes.h" |
---|
[11612] | 32 | #include <string> |
---|
[11607] | 33 | |
---|
[11612] | 34 | namespace orxonox { |
---|
[11782] | 35 | ManageScopedSingleton(DialogManager, ScopeID::ROOT, false); |
---|
[11607] | 36 | |
---|
| 37 | |
---|
| 38 | |
---|
[11782] | 39 | DialogManager::DialogManager() |
---|
| 40 | { |
---|
| 41 | this->currentTalk_ = nullptr; |
---|
| 42 | this->answerIds_ = nullptr; |
---|
| 43 | } |
---|
[11612] | 44 | |
---|
[11782] | 45 | void DialogManager::setDialog(Dialog* dialog) |
---|
| 46 | { |
---|
| 47 | this->currentTalk_ = dialog; |
---|
| 48 | this->answerIds_ = &this->currentTalk_->getAnswerIds(); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | //from here onward funcionality for lua axports |
---|
| 52 | |
---|
[11612] | 53 | std::string DialogManager::getQuestion() |
---|
| 54 | { |
---|
[11782] | 55 | return this->currentTalk_->getQuestionString(); |
---|
[11612] | 56 | } |
---|
| 57 | |
---|
[11642] | 58 | int DialogManager::getSize() |
---|
| 59 | { |
---|
[11644] | 60 | return this->answerIds_->size(); |
---|
[11642] | 61 | } |
---|
| 62 | |
---|
| 63 | std::string DialogManager::getAnswer(int index) |
---|
[11612] | 64 | { |
---|
[11782] | 65 | return this->currentTalk_->getAnswerString(this->answerIds_->at(index)); |
---|
[11612] | 66 | } |
---|
[11782] | 67 | |
---|
[11642] | 68 | std::string DialogManager::getPerson() |
---|
| 69 | { |
---|
[11782] | 70 | return this->currentTalk_->getName(); |
---|
[11642] | 71 | } |
---|
| 72 | |
---|
[11644] | 73 | bool DialogManager::endtest(int index) |
---|
| 74 | { |
---|
| 75 | if(this->answerIds_->empty()) |
---|
| 76 | { |
---|
| 77 | return true; |
---|
| 78 | } |
---|
| 79 | else |
---|
| 80 | { |
---|
| 81 | return this->currentTalk_->ending(this->answerIds_->at(index)); |
---|
| 82 | } |
---|
| 83 | |
---|
[11642] | 84 | } |
---|
| 85 | |
---|
| 86 | void DialogManager::update(int index) |
---|
| 87 | { |
---|
[11782] | 88 | this->currentTalk_->update(this->answerIds_->at(index)); |
---|
| 89 | this->answerIds_ = &this->currentTalk_->getAnswerIds(); |
---|
[11642] | 90 | } |
---|
[11607] | 91 | } |
---|