[Scummvm-git-logs] scummvm master -> 3087136bab8b571fd13648ba4dcff6d779d740a6

dreammaster dreammaster at scummvm.org
Sat Jan 28 21:08:29 CET 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
3087136bab TITANIC: Renamed sentence concept fields in CScriptHandler


Commit: 3087136bab8b571fd13648ba4dcff6d779d740a6
    https://github.com/scummvm/scummvm/commit/3087136bab8b571fd13648ba4dcff6d779d740a6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-01-28T15:08:15-05:00

Commit Message:
TITANIC: Renamed sentence concept fields in CScriptHandler

Changed paths:
    engines/titanic/true_talk/script_handler.cpp
    engines/titanic/true_talk/script_handler.h
    engines/titanic/true_talk/tt_concept_node.cpp
    engines/titanic/true_talk/tt_parser.cpp
    engines/titanic/true_talk/tt_parser.h
    engines/titanic/true_talk/tt_sentence.cpp


diff --git a/engines/titanic/true_talk/script_handler.cpp b/engines/titanic/true_talk/script_handler.cpp
index be0b89b..13c88e2 100644
--- a/engines/titanic/true_talk/script_handler.cpp
+++ b/engines/titanic/true_talk/script_handler.cpp
@@ -32,8 +32,8 @@ namespace Titanic {
 /*------------------------------------------------------------------------*/
 
 CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) :
-		_owner(owner), _script(owner->_script), _parser(this), _inputCtr(0), _concept1P(nullptr),
-		_concept2P(nullptr), _concept3P(nullptr), _concept4P(nullptr) {
+		_owner(owner), _script(owner->_script), _parser(this), _inputCtr(0), _conceptObject(nullptr),
+		_conceptActor(nullptr), _conceptUnused(nullptr), _conceptVerb(nullptr) {
 	g_vm->_scriptHandler = this;
 	g_vm->_script = _script;
 	g_vm->_exeResources.reset(this, val1, val2);
@@ -42,10 +42,10 @@ CScriptHandler::CScriptHandler(CTitleEngine *owner, int val1, int val2) :
 
 CScriptHandler::~CScriptHandler() {
 	delete _vocab;
-	delete _concept1P;
-	delete _concept2P;
-	delete _concept3P;
-	delete _concept4P;
+	delete _conceptObject;
+	delete _conceptActor;
+	delete _conceptUnused;
+	delete _conceptVerb;
 }
 
 ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnpcScript *npcScript, uint dialogueId) {
@@ -59,14 +59,14 @@ ScriptChangedResult CScriptHandler::scriptChanged(TTroomScript *roomScript, TTnp
 		result = npcScript->notifyScript(roomScript, dialogueId);
 
 	if (dialogueId == 3 || dialogueId == 4) {
-		delete _concept1P;
-		delete _concept2P;
-		delete _concept3P;
-		delete _concept4P;
-		_concept1P = nullptr;
-		_concept2P = nullptr;
-		_concept3P = nullptr;
-		_concept4P = nullptr;
+		delete _conceptObject;
+		delete _conceptActor;
+		delete _conceptUnused;
+		delete _conceptVerb;
+		_conceptObject = nullptr;
+		_conceptActor = nullptr;
+		_conceptUnused = nullptr;
+		_conceptVerb = nullptr;
 	}
 
 	++_inputCtr;
@@ -116,29 +116,29 @@ int CScriptHandler::setResponse(TTscriptBase *script, TTresponse *response) {
 }
 
 void CScriptHandler::handleWord(const TTstring *str) {
-	handleWord1(str);
-	handleWord2(str);
+	setActor(str);
+	setObject(str);
 }
 
-void CScriptHandler::handleWord1(const TTstring *str) {
-	if (_concept2P)
-		delete _concept2P;
-	_concept2P = nullptr;
+void CScriptHandler::setActor(const TTstring *str) {
+	if (_conceptActor)
+		delete _conceptActor;
+	_conceptActor = nullptr;
 
 	if (str) {
 		TTword word(*str, WC_UNKNOWN, 0);
-		_concept2P = new TTconcept(&word);
+		_conceptActor = new TTconcept(&word);
 	}
 }
 
-void CScriptHandler::handleWord2(const TTstring *str) {
-	if (_concept1P)
-		delete _concept1P;
-	_concept1P = nullptr;
+void CScriptHandler::setObject(const TTstring *str) {
+	if (_conceptObject)
+		delete _conceptObject;
+	_conceptObject = nullptr;
 
 	if (str) {
 		TTword word(*str, WC_UNKNOWN, 0);
-		_concept1P = new TTconcept(&word);
+		_conceptObject = new TTconcept(&word);
 	}
 }
 
diff --git a/engines/titanic/true_talk/script_handler.h b/engines/titanic/true_talk/script_handler.h
index b8e62a5..824738d 100644
--- a/engines/titanic/true_talk/script_handler.h
+++ b/engines/titanic/true_talk/script_handler.h
@@ -39,16 +39,16 @@ private:
 	CTitleEngine *_owner;
 	int _inputCtr;
 private:
-	void handleWord1(const TTstring *str);
-	void handleWord2(const TTstring *str);
+	void setActor(const TTstring *str);
+	void setObject(const TTstring *str);
 public:
 	TTparser _parser;
 	TTvocab *_vocab;
 	TTscriptBase *_script;
-	TTconcept *_concept1P;
-	TTconcept *_concept2P;
-	TTconcept *_concept3P;
-	TTconcept *_concept4P;
+	TTconcept *_conceptObject;
+	TTconcept *_conceptActor;
+	TTconcept *_conceptUnused;
+	TTconcept *_conceptVerb;
 public:
 	CScriptHandler(CTitleEngine *owner, int val1, int val2);
 	~CScriptHandler();
diff --git a/engines/titanic/true_talk/tt_concept_node.cpp b/engines/titanic/true_talk/tt_concept_node.cpp
index 4573516..3736418 100644
--- a/engines/titanic/true_talk/tt_concept_node.cpp
+++ b/engines/titanic/true_talk/tt_concept_node.cpp
@@ -79,18 +79,18 @@ TTconcept **TTconceptNode::setConcept(int conceptIndex, TTconcept *src) {
 		if (!isPronoun) {
 			switch (conceptIndex) {
 			case 0:
-				delete scrHandler._concept2P;
-				scrHandler._concept2P = new TTconcept(*src);
+				delete scrHandler._conceptActor;
+				scrHandler._conceptActor = new TTconcept(*src);
 				break;
 
 			case 1:
-				delete scrHandler._concept4P;
-				scrHandler._concept4P = new TTconcept(*src);
+				delete scrHandler._conceptVerb;
+				scrHandler._conceptVerb = new TTconcept(*src);
 				break;
 
 			case 2:
-				delete scrHandler._concept1P;
-				scrHandler._concept1P = new TTconcept(*src);
+				delete scrHandler._conceptObject;
+				scrHandler._conceptObject = new TTconcept(*src);
 				break;
 
 			default:
diff --git a/engines/titanic/true_talk/tt_parser.cpp b/engines/titanic/true_talk/tt_parser.cpp
index 88a5ec3..dd786db 100644
--- a/engines/titanic/true_talk/tt_parser.cpp
+++ b/engines/titanic/true_talk/tt_parser.cpp
@@ -765,13 +765,13 @@ int TTparser::considerRequests(TTword *word) {
 		case SEEK_ACTOR:
 		case MKTAG('S', 'A', 'C', 'T'):
 			if (!_sentenceConcept->_concept0P) {
-				flag = filterConcepts(5, 0);
+				flag = applyConcepts(5, 0);
 			} else if (_sentenceConcept->_concept0P->compareTo("?") &&
 						_sentenceConcept->_concept1P->isWordId(113) &&
 						word->_wordClass == WC_THING) {
 				TTconcept *oldConcept = _sentenceConcept->_concept0P;
 				_sentenceConcept->_concept0P = nullptr;
-				flag = filterConcepts(5, 2);
+				flag = applyConcepts(5, 2);
 				if (flag)
 					delete oldConcept;
 			} else {
@@ -783,11 +783,11 @@ int TTparser::considerRequests(TTword *word) {
 			if (_sentenceConcept->_concept2P && _sentenceConcept->_concept2P->compareTo(word)) {
 				flag = true;
 			} else if (!_sentenceConcept->_concept2P) {
-				if (filterConcepts(5, 2) && _sentenceConcept->_concept2P->checkWordId1())
+				if (applyConcepts(5, 2) && _sentenceConcept->_concept2P->checkWordId1())
 					addNode(SEEK_OBJECT);
 			} else if (word->_wordClass == WC_THING && _sentence->fn2(2, TTstring("?"), _sentenceConcept)) {
 				TTconcept *oldConcept = _sentenceConcept->_concept2P;
-				flag = filterConcepts(5, 2);
+				flag = applyConcepts(5, 2);
 				_sentenceConcept->_concept2P->_field20 = oldConcept->get20();
 				if (flag)
 					delete oldConcept;
@@ -807,7 +807,7 @@ int TTparser::considerRequests(TTword *word) {
 
 				if (!status && !_sentenceConcept->_concept4P && _sentenceConcept->_concept0P) {
 					TTconcept *oldConcept = _sentenceConcept->_concept2P;
-					flag = filterConcepts(5, 2);
+					flag = applyConcepts(5, 2);
 					_sentenceConcept->_concept2P->_field20 = oldConcept->get20();
 					if (flag)
 						delete oldConcept;
@@ -824,7 +824,7 @@ int TTparser::considerRequests(TTword *word) {
 				_sentenceConcept->_concept3P = _sentenceConcept->_concept2P;
 				_sentenceConcept->_concept2P = nullptr;
 
-				flag = filterConcepts(5, 2);
+				flag = applyConcepts(5, 2);
 				if (!flag) {
 					status = _sentenceConcept->createConcept(0, 2, word);
 				}
@@ -833,8 +833,8 @@ int TTparser::considerRequests(TTword *word) {
 
 		case SEEK_TO:
 			if (!_sentenceConcept->_concept3P) {
-				if (!filterConcepts(8, 3))
-					flag = filterConcepts(3, 3);
+				if (!applyConcepts(8, 3))
+					flag = applyConcepts(3, 3);
 			} else {
 				flag = true;
 			}
@@ -842,8 +842,8 @@ int TTparser::considerRequests(TTword *word) {
 
 		case SEEK_FROM:
 			if (!_sentenceConcept->_concept4P) {
-				if (!filterConcepts(8, 4))
-					flag = filterConcepts(3, 3);
+				if (!applyConcepts(8, 4))
+					flag = applyConcepts(3, 3);
 			} else {
 				flag = true;
 			}
@@ -906,14 +906,14 @@ int TTparser::considerRequests(TTword *word) {
 						_sentenceConcept->_concept5P->findByWordId(904)) {
 					TTconcept *oldConcept = _sentenceConcept->_concept5P;
 					_sentenceConcept->_concept5P = nullptr;
-					flag = filterConcepts(9, 5);
+					flag = applyConcepts(9, 5);
 					if (flag)
 						delete oldConcept;
 				} else {
 					flag = true;
 				}
 			} else {
-				flag = filterConcepts(9, 5);
+				flag = applyConcepts(9, 5);
 				if (!flag && word->_wordClass == WC_ADVERB) {
 					status = _sentenceConcept->createConcept(1, 5, word);
 					flag = true;
@@ -1471,7 +1471,7 @@ int TTparser::checkForAction() {
 	if (!_sentenceConcept->_concept0P && !_sentenceConcept->_concept1P &&
 			!_sentenceConcept->_concept2P && !_sentenceConcept->_concept5P && !flag) {
 		if (_conceptP)
-			filterConcepts(5, 2);
+			applyConcepts(5, 2);
 
 		if (!_sentenceConcept->_concept2P && _sentence->_category == 1)
 			_sentence->_category = 0;
@@ -1508,7 +1508,7 @@ int TTparser::checkForAction() {
 	} else if (!_sentenceConcept->_concept0P && !_sentenceConcept->_concept1P &&
 			!_sentenceConcept->_concept2P && !_sentenceConcept->_concept5P) {
 		if (_conceptP)
-			filterConcepts(5, 2);
+			applyConcepts(5, 2);
 
 		if (!_sentenceConcept->_concept2P && _sentence->_category == 1)
 			_sentence->_category = 0;
@@ -1597,7 +1597,7 @@ bool TTparser::checkConcept2(TTconcept *concept, int conceptMode) {
 	return false;
 }
 
-int TTparser::filterConcepts(int conceptMode, int conceptIndex) {
+int TTparser::applyConcepts(int conceptMode, int conceptIndex) {
 	int result = 0;
 
 	for (TTconcept *currP = _conceptP; currP && !result; currP = currP->_nextP) {
diff --git a/engines/titanic/true_talk/tt_parser.h b/engines/titanic/true_talk/tt_parser.h
index 458a719..d5e2d3a 100644
--- a/engines/titanic/true_talk/tt_parser.h
+++ b/engines/titanic/true_talk/tt_parser.h
@@ -174,7 +174,7 @@ private:
 	int checkForAction();
 	int fn2(TTword *word);
 	bool checkConcept2(TTconcept *concept, int conceptMode);
-	int filterConcepts(int conceptMode, int conceptIndex);
+	int applyConcepts(int conceptMode, int conceptIndex);
 	bool resetConcept(TTconcept **conceptPP, int conceptIndex);
 public:
 	CScriptHandler *_owner;
diff --git a/engines/titanic/true_talk/tt_sentence.cpp b/engines/titanic/true_talk/tt_sentence.cpp
index 5a5bff7..5306288 100644
--- a/engines/titanic/true_talk/tt_sentence.cpp
+++ b/engines/titanic/true_talk/tt_sentence.cpp
@@ -195,24 +195,24 @@ bool TTsentence::fn2(int slotIndex, const TTstring &str, const TTconceptNode *no
 		return true;
 	}
 
-	if (slotIndex == 1 && g_vm->_exeResources._owner->_concept4P) {
-		if (str == g_vm->_exeResources._owner->_concept4P->getText() &&
+	if (slotIndex == 1 && g_vm->_exeResources._owner->_conceptVerb) {
+		if (str == g_vm->_exeResources._owner->_conceptVerb->getText() &&
 				conceptText == "do")
 			goto exit;
 	}
 
-	if (g_vm->_exeResources._owner->_concept2P && (slotIndex == 0 ||
+	if (g_vm->_exeResources._owner->_conceptActor && (slotIndex == 0 ||
 			slotIndex == 3 || slotIndex == 4)) {
-		if (str == g_vm->_exeResources._owner->_concept2P->getText() &&
+		if (str == g_vm->_exeResources._owner->_conceptActor->getText() &&
 				(conceptText == "it" || conceptText == "he" || conceptText == "she" ||
 				conceptText == "him" || conceptText == "her" || conceptText == "them" ||
 				conceptText == "they"))
 			goto exit;
 	}
 
-	if (g_vm->_exeResources._owner->_concept1P && (slotIndex == 0 ||
+	if (g_vm->_exeResources._owner->_conceptObject && (slotIndex == 0 ||
 		slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5)) {
-		if (str == g_vm->_exeResources._owner->_concept1P->getText() &&
+		if (str == g_vm->_exeResources._owner->_conceptObject->getText() &&
 			(conceptText == "it" || conceptText == "that" || conceptText == "he" ||
 				conceptText == "she" || conceptText == "him" || conceptText == "her" ||
 				conceptText == "them" || conceptText == "they" || conceptText == "those" ||
@@ -220,8 +220,8 @@ bool TTsentence::fn2(int slotIndex, const TTstring &str, const TTconceptNode *no
 			goto exit;
 	}
 
-	if (g_vm->_exeResources._owner->_concept1P && (slotIndex == 0 || slotIndex == 2)) {
-		if (conceptText == "?" && str == g_vm->_exeResources._owner->_concept1P->getText()) {
+	if (g_vm->_exeResources._owner->_conceptObject && (slotIndex == 0 || slotIndex == 2)) {
+		if (conceptText == "?" && str == g_vm->_exeResources._owner->_conceptObject->getText()) {
 			delete concept;
 			concept = getFrameSlot(5, node);
 			conceptText = concept->getText();
@@ -307,12 +307,12 @@ bool TTsentence::localWord(const char *str) const {
 	CScriptHandler &scriptHandler = *g_vm->_exeResources._owner;
 	bool foundMatch = false;
 
-	if (scriptHandler._concept1P) {
-		TTstring s = scriptHandler._concept1P->getText();
+	if (scriptHandler._conceptObject) {
+		TTstring s = scriptHandler._conceptObject->getText();
 		if (s == str)
 			foundMatch = true;
-	} else if (scriptHandler._concept2P) {
-			TTstring s = scriptHandler._concept2P->getText();
+	} else if (scriptHandler._conceptActor) {
+			TTstring s = scriptHandler._conceptActor->getText();
 			if (s == str)
 				foundMatch = true;
 	}





More information about the Scummvm-git-logs mailing list