aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2011-01-29 07:21:31 +0000
committerNicola Mettifogo2011-01-29 07:21:31 +0000
commite1046d3eae8207bc3c65cd6a558dd20191aede3c (patch)
treebc7a381278c0163269b7f7c4218afa59ddaaac8e /engines/parallaction
parentc3698a2cd5c98bf69ed7eb5425398f15f3453021 (diff)
downloadscummvm-rg350-e1046d3eae8207bc3c65cd6a558dd20191aede3c.tar.gz
scummvm-rg350-e1046d3eae8207bc3c65cd6a558dd20191aede3c.tar.bz2
scummvm-rg350-e1046d3eae8207bc3c65cd6a558dd20191aede3c.zip
PARALLACTION: Simplify text comparisons in dialogue code.
Encapsulate text comparison into string owners and removed some ugly double negative logic. svn-id: r55605
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/dialogue.cpp6
-rw-r--r--engines/parallaction/objects.cpp8
-rw-r--r--engines/parallaction/objects.h2
3 files changed, 13 insertions, 3 deletions
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index 5922d002c6..098ca90ef9 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -214,7 +214,7 @@ void DialogueManager::displayAnswers() {
}
int16 DialogueManager::selectAnswer1() {
- if (!_visAnswers[0]._a->_text.compareToIgnoreCase("null")) {
+ if (_visAnswers[0]._a->textIsNull()) {
return _visAnswers[0]._index;
}
@@ -250,7 +250,7 @@ int16 DialogueManager::selectAnswerN() {
}
bool DialogueManager::displayQuestion() {
- if (!_q->_text.compareToIgnoreCase("NULL")) return false;
+ if (_q->textIsNull()) return false;
_vm->_balloonMan->setSingleBalloon(_q->_text, _ballonPos._questionBalloon.x, _ballonPos._questionBalloon.y, _q->_mood & 0x10, BalloonManager::kNormalColor);
_faceId = _vm->_gfx->setItem(_questioner, _ballonPos._questionChar.x, _ballonPos._questionChar.y);
@@ -283,7 +283,7 @@ void DialogueManager::nextAnswer() {
return;
}
- if (!_visAnswers[0]._a->_text.compareToIgnoreCase("NULL")) {
+ if (_visAnswers[0]._a->textIsNull()) {
// if the first answer is null (it's implied that it's the
// only one because we already called addVisibleAnswers),
// then jump to the next question
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index acc6dad759..ecdb0683f4 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -258,6 +258,10 @@ Answer::Answer() {
_hasCounterCondition = false;
}
+bool Answer::textIsNull() {
+ return (_text.equalsIgnoreCase("NULL"));
+}
+
Question::Question(const Common::String &name) : _name(name), _mood(0) {
memset(_answers, 0, sizeof(_answers));
}
@@ -268,6 +272,10 @@ Question::~Question() {
}
}
+bool Question::textIsNull() {
+ return (_text.equalsIgnoreCase("NULL"));
+}
+
Instruction::Instruction() {
_index = 0;
_flags = 0;
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index 36231cfcc5..50a188e91b 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -163,6 +163,7 @@ struct Answer {
int _counterOp;
Answer();
+ bool textIsNull();
};
struct Question {
@@ -173,6 +174,7 @@ struct Question {
Question(const Common::String &name);
~Question();
+ bool textIsNull();
};
struct Dialogue {