mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 18:06:26 +00:00
PARALLACTION: Simplify text comparisons in dialogue code.
Encapsulate text comparison into string owners and removed some ugly double negative logic. svn-id: r55605
This commit is contained in:
parent
c3698a2cd5
commit
e1046d3eae
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user