diff options
author | Nicola Mettifogo | 2009-03-24 08:20:08 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2009-03-24 08:20:08 +0000 |
commit | 76c0d0820059d5e9e4addeb40de35adbd99e061a (patch) | |
tree | 9802e26544fa790393aefb22044dd022449b986c /engines/parallaction/objects.cpp | |
parent | e9b4124f1d82f0bfcafdbbb40797c7d767e16c91 (diff) | |
download | scummvm-rg350-76c0d0820059d5e9e4addeb40de35adbd99e061a.tar.gz scummvm-rg350-76c0d0820059d5e9e4addeb40de35adbd99e061a.tar.bz2 scummvm-rg350-76c0d0820059d5e9e4addeb40de35adbd99e061a.zip |
* Pushed evaluation of 'following question' from dialogue parsing to dialogue execution.
* Removed all the question forwards declaration code
svn-id: r39654
Diffstat (limited to 'engines/parallaction/objects.cpp')
-rw-r--r-- | engines/parallaction/objects.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp index c852d58881..8358a20ad2 100644 --- a/engines/parallaction/objects.cpp +++ b/engines/parallaction/objects.cpp @@ -212,6 +212,7 @@ bool Zone::hitRect(int x, int y) const { Dialogue::Dialogue() { memset(_questions, 0, sizeof(_questions)); + _numQuestions = 0; } Dialogue::~Dialogue() { @@ -220,20 +221,31 @@ Dialogue::~Dialogue() { } } +Question *Dialogue::findQuestion(const Common::String &name) const { + for (uint i = 0; _questions[i]; ++i) { + if (_questions[i]->_name == name) { + return _questions[i]; + } + } + return 0; +} + +void Dialogue::addQuestion(Question *q) { + assert(_numQuestions < NUM_QUESTIONS); + assert(q); + _questions[_numQuestions] = q; + _numQuestions++; +} + Answer::Answer() { _mood = 0; - _followingQuestion = NULL; _noFlags = 0; _yesFlags = 0; _hasCounterCondition = false; } -Question::Question() { - _mood = 0; - - for (uint32 i = 0; i < NUM_ANSWERS; i++) - _answers[i] = NULL; - +Question::Question(const Common::String &name) : _name(name), _mood(0) { + memset(_answers, 0, sizeof(_answers)); } Question::~Question() { |