[Scummvm-cvs-logs] SF.net SVN: scummvm:[46267] scummvm/trunk/engines/m4/console.cpp

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sat Dec 5 08:47:01 CET 2009


Revision: 46267
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46267&view=rev
Author:   dreammaster
Date:     2009-12-05 07:47:01 +0000 (Sat, 05 Dec 2009)

Log Message:
-----------
Added a new variation to the 'object' command to add an object to the player's inventory

Modified Paths:
--------------
    scummvm/trunk/engines/m4/console.cpp

Modified: scummvm/trunk/engines/m4/console.cpp
===================================================================
--- scummvm/trunk/engines/m4/console.cpp	2009-12-05 07:46:41 UTC (rev 46266)
+++ scummvm/trunk/engines/m4/console.cpp	2009-12-05 07:47:01 UTC (rev 46267)
@@ -304,7 +304,7 @@
 	if (_vm->isM4()) {
 		DebugPrintf("Command not implemented for M4 games\n");
 	} else if (argc == 1) {
-		DebugPrintf("Usage: object ['list' | '#objnum']\n");
+		DebugPrintf("Usage: object ['list' | '#objnum' | 'add #objnum']\n");
 	} else if (!strcmp(argv[1], "list")) {
 		// List of objects
 		for (uint objStart = 0; objStart < _vm->_globals->getObjectsSize(); objStart += 5) {
@@ -319,16 +319,29 @@
 		}
 
 		DebugPrintf("\n");
+	} else if (!strcmp(argv[1], "add") && (argc == 3)) {
+		// Add the specified object to the player's inventory
+		int objNum = strToInt(argv[2]);
+
+		if ((objNum < 0) || (objNum >= (int)_vm->_globals->getObjectsSize()))
+			DebugPrintf("Invalid object specified\n");
+		else if (_vm->isM4())
+			DebugPrintf("Not implemented for M4 games\n");
+		else {
+			_vm->_scene->getMadsInterface()->addObjectToInventory(objNum);
+			return false;
+		}
+
 	} else {
 		// Print the details of a specific object
-		int id = strToInt(argv[1]);
+		int objNum = strToInt(argv[1]);
 
-		if ((id < 0) || (id >= (int)_vm->_globals->getObjectsSize()))
+		if ((objNum < 0) || (objNum >= (int)_vm->_globals->getObjectsSize()))
 			DebugPrintf("Invalid object specified\n");
 		else {
-			const MadsObject *obj = _vm->_globals->getObject(id);
+			const MadsObject *obj = _vm->_globals->getObject(objNum);
 
-			DebugPrintf("Object #%d (%s) room=%d article=%d/%s vocabs=%d", id, _vm->_globals->getVocab(obj->descId),
+			DebugPrintf("Object #%d (%s) room=%d article=%d/%s vocabs=%d", objNum, _vm->_globals->getVocab(obj->descId),
 				obj->roomNumber, (int)obj->article, englishMADSArticleList[obj->article], obj->vocabCount);
 
 			if (obj->vocabCount > 0) {


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