[Scummvm-cvs-logs] SF.net SVN: scummvm:[52933] scummvm/trunk/engines/hugo

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Tue Sep 28 21:49:53 CEST 2010


Revision: 52933
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52933&view=rev
Author:   strangerke
Date:     2010-09-28 19:49:53 +0000 (Tue, 28 Sep 2010)

Log Message:
-----------
HUGO: Suppress useless parameter in several functions

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/parser.cpp
    scummvm/trunk/engines/hugo/parser.h

Modified: scummvm/trunk/engines/hugo/parser.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser.cpp	2010-09-28 19:06:03 UTC (rev 52932)
+++ scummvm/trunk/engines/hugo/parser.cpp	2010-09-28 19:49:53 UTC (rev 52933)
@@ -212,7 +212,6 @@
 // Parse the user's line of text input.  Generate events as necessary
 void Parser::lineHandler() {
 	char     *noun, *verb;                          // ptrs to noun and verb strings
-//	int       i;
 	object_t *obj;
 	char      farComment[XBYTES * 5] = "";          // hold 5 line comment if object not nearby
 	char      contextComment[XBYTES * 5] = "";      // Unused comment for context objects
@@ -305,7 +304,7 @@
 	for (int i = 0; i < _vm._numObj; i++) {
 		obj = &_vm._objects[i];
 		if (isWordPresent(_vm._arrayNouns[obj->nounIndex]))
-			if (isObjectVerb(obj, _line, farComment) || isGenericVerb(obj, _line, farComment))
+			if (isObjectVerb(obj, farComment) || isGenericVerb(obj, farComment))
 				return;
 	}
 
@@ -314,18 +313,18 @@
 	for (int i = 0; i < _vm._numObj; i++) {
 		obj = &_vm._objects[i];
 		if (obj->verbOnlyFl)
-			if (isObjectVerb(obj, _line, contextComment) || isGenericVerb(obj, _line, contextComment))
+			if (isObjectVerb(obj, contextComment) || isGenericVerb(obj, contextComment))
 				return;
 	}
 
 	// No objects match command line, try background and catchall commands
-	if (isBackgroundWord(_vm._backgroundObjects[*_vm._screen_p], _line))
+	if (isBackgroundWord(_vm._backgroundObjects[*_vm._screen_p]))
 		return;
-	if (isCatchallVerb(_vm._backgroundObjects[*_vm._screen_p], _line))
+	if (isCatchallVerb(_vm._backgroundObjects[*_vm._screen_p]))
 		return;
-	if (isBackgroundWord(_vm._catchallList, _line))
+	if (isBackgroundWord(_vm._catchallList))
 		return;
-	if (isCatchallVerb(_vm._catchallList, _line))
+	if (isCatchallVerb(_vm._catchallList))
 		return;
 
 	// If a not-near comment was generated, print it
@@ -335,8 +334,8 @@
 	}
 
 	// Nothing matches.  Report recognition success to user.
-	verb = findVerb(_line);
-	noun = findNoun(_line);
+	verb = findVerb();
+	noun = findNoun();
 	if (verb == _vm._arrayVerbs[_vm._look][0] && _maze.enabledFl) {
 		Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBMaze]);
 		showTakeables();
@@ -352,8 +351,8 @@
 
 // Search for matching verb/noun pairs in background command list
 // Print text for possible background object.  Return TRUE if match found
-bool Parser::isBackgroundWord(objectList_t obj, char *line) {
-	debugC(1, kDebugParser, "isBackgroundWord(object_list_t obj, %s)", line);
+bool Parser::isBackgroundWord(objectList_t obj) {
+	debugC(1, kDebugParser, "isBackgroundWord(object_list_t obj)");
 
 	for (int i = 0; obj[i].verbIndex != 0; i++)
 		if (isWordPresent(_vm._arrayVerbs[obj[i].verbIndex]) &&
@@ -371,12 +370,12 @@
 // Noun is not required.  Return TRUE if match found
 // Note that if the background command list has match set TRUE then do not
 // print text if there are any recognizable nouns in the command line
-bool Parser::isCatchallVerb(objectList_t obj, char *line) {
-	debugC(1, kDebugParser, "isCatchallVerb(object_list_t obj, %s)", line);
+bool Parser::isCatchallVerb(objectList_t obj) {
+	debugC(1, kDebugParser, "isCatchallVerb(object_list_t obj)");
 
 	for (int i = 0; obj[i].verbIndex != 0; i++)
 		if (isWordPresent(_vm._arrayVerbs[obj[i].verbIndex]) && obj[i].nounIndex == 0 &&
-		        (!obj[i].matchFl || !findNoun(line)) &&
+		        (!obj[i].matchFl || !findNoun()) &&
 		        ((obj[i].roomState == DONT_CARE) ||
 		         (obj[i].roomState == _vm._screenStates[*_vm._screen_p]))) {
 			Utils::Box(BOX_ANY, "%s", _vm.file().fetchString(obj[i].commentIndex));
@@ -460,23 +459,23 @@
 }
 
 // Locate word in list of nouns and return ptr to first string in noun list
-char *Parser::findNoun(char *line) {
-	debugC(1, kDebugParser, "findNoun(%s)", line);
+char *Parser::findNoun() {
+	debugC(1, kDebugParser, "findNoun()");
 
 	for (int i = 0; _vm._arrayNouns[i]; i++)
 		for (int j = 0; strlen(_vm._arrayNouns[i][j]); j++)
-			if (strstr(line, _vm._arrayNouns[i][j]))
+			if (strstr(_line, _vm._arrayNouns[i][j]))
 				return(_vm._arrayNouns[i][0]);
 	return NULL;
 }
 
 // Locate word in list of verbs and return ptr to first string in verb list
-char *Parser::findVerb(char *line) {
-	debugC(1, kDebugParser, "findVerb(%s)", line);
+char *Parser::findVerb() {
+	debugC(1, kDebugParser, "findVerb()");
 
 	for (int i = 0; _vm._arrayVerbs[i]; i++)
 		for (int j = 0; strlen(_vm._arrayVerbs[i][j]); j++)
-			if (strstr(line, _vm._arrayVerbs[i][j]))
+			if (strstr(_line, _vm._arrayVerbs[i][j]))
 				return(_vm._arrayVerbs[i][0]);
 	return NULL;
 }
@@ -533,8 +532,8 @@
 }
 
 // Test whether command line contains one of the generic actions
-bool Parser::isGenericVerb(object_t *obj, char *line, char *comment) {
-	debugC(1, kDebugParser, "isGenericVerb(object_t *obj, %s, %s)", line, comment);
+bool Parser::isGenericVerb(object_t *obj, char *comment) {
+	debugC(1, kDebugParser, "isGenericVerb(object_t *obj, %s)", comment);
 
 	if (!obj->genericCmd)
 		return false;
@@ -593,14 +592,14 @@
 // Test whether command line contains a verb allowed by this object.
 // If it does, and the object is near and passes the tests in the command
 // list then carry out the actions in the action list and return TRUE
-bool Parser::isObjectVerb(object_t *obj, char *line, char *comment) {
+bool Parser::isObjectVerb(object_t *obj, char *comment) {
 	int     i;
 	cmd    *cmnd;
 	char   *verb;
 	uint16 *reqs;
 	uint16  cmdIndex;
 
-	debugC(1, kDebugParser, "isObjectVerb(object_t *obj, %s, %s)", line, comment);
+	debugC(1, kDebugParser, "isObjectVerb(object_t *obj, %s)", comment);
 
 	// First, find matching verb in cmd list
 	cmdIndex = obj->cmdIndex;                       // ptr to list of commands
@@ -643,7 +642,7 @@
 
 	// See if any additional generic actions
 	if ((verb == _vm._arrayVerbs[_vm._look][0]) || (verb == _vm._arrayVerbs[_vm._take][0]) || (verb == _vm._arrayVerbs[_vm._drop][0]))
-		isGenericVerb(obj, line, comment);
+		isGenericVerb(obj, comment);
 	return true;
 }
 

Modified: scummvm/trunk/engines/hugo/parser.h
===================================================================
--- scummvm/trunk/engines/hugo/parser.h	2010-09-28 19:06:03 UTC (rev 52932)
+++ scummvm/trunk/engines/hugo/parser.h	2010-09-28 19:49:53 UTC (rev 52933)
@@ -52,23 +52,24 @@
 	void  keyHandler(uint16 nChar, uint16 nFlags);
 	void  lineHandler();
 
-private:
+protected:
 	HugoEngine &_vm;
 
+private:
 	char   _ringBuffer[32];                         // Ring buffer
 	uint16 _putIndex;
 	uint16 _getIndex;                               // Index into ring buffer
 	bool   _checkDoubleF1Fl;                        // Flag used to display user help or instructions
 
-	bool  isBackgroundWord(objectList_t obj, char *line);
+	bool  isBackgroundWord(objectList_t obj);
 	bool  isCarrying(uint16 wordIndex);
-	bool  isCatchallVerb(objectList_t obj, char *line);
-	bool  isGenericVerb(object_t *obj, char *line, char *comment);
+	bool  isCatchallVerb(objectList_t obj);
+	bool  isGenericVerb(object_t *obj, char *comment);
 	bool  isNear(object_t *obj, char *verb, char *comment);
-	bool  isObjectVerb(object_t *obj, char *line, char *comment);
+	bool  isObjectVerb(object_t *obj, char *comment);
 
-	char *findNoun(char *line);
-	char *findVerb(char *line);
+	char *findNoun();
+	char *findVerb();
 
 	void  dropObject(object_t *obj);
 	void  showDosInventory();


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