[Scummvm-cvs-logs] SF.net SVN: scummvm:[55605] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sat Jan 29 08:21:31 CET 2011


Revision: 55605
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55605&view=rev
Author:   peres001
Date:     2011-01-29 07:21:31 +0000 (Sat, 29 Jan 2011)

Log Message:
-----------
PARALLACTION: Simplify text comparisons in dialogue code.

Encapsulate text comparison into string owners and removed some ugly
double negative logic.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/dialogue.cpp
    scummvm/trunk/engines/parallaction/objects.cpp
    scummvm/trunk/engines/parallaction/objects.h

Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp	2011-01-29 07:21:13 UTC (rev 55604)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp	2011-01-29 07:21:31 UTC (rev 55605)
@@ -214,7 +214,7 @@
 }
 
 int16 DialogueManager::selectAnswer1() {
-	if (!_visAnswers[0]._a->_text.compareToIgnoreCase("null")) {
+	if (_visAnswers[0]._a->textIsNull()) {
 		return _visAnswers[0]._index;
 	}
 
@@ -250,7 +250,7 @@
 }
 
 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 @@
 		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

Modified: scummvm/trunk/engines/parallaction/objects.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/objects.cpp	2011-01-29 07:21:13 UTC (rev 55604)
+++ scummvm/trunk/engines/parallaction/objects.cpp	2011-01-29 07:21:31 UTC (rev 55605)
@@ -258,6 +258,10 @@
 	_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 @@
 	}
 }
 
+bool Question::textIsNull() {
+	return (_text.equalsIgnoreCase("NULL"));
+}
+	
 Instruction::Instruction() {
 	_index = 0;
 	_flags = 0;

Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h	2011-01-29 07:21:13 UTC (rev 55604)
+++ scummvm/trunk/engines/parallaction/objects.h	2011-01-29 07:21:31 UTC (rev 55605)
@@ -163,6 +163,7 @@
 	int	_counterOp;
 
 	Answer();
+	bool textIsNull();
 };
 
 struct Question {
@@ -173,6 +174,7 @@
 
 	Question(const Common::String &name);
 	~Question();
+	bool textIsNull();
 };
 
 struct Dialogue {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list