[Scummvm-cvs-logs] SF.net SVN: scummvm:[45400] scummvm/trunk/engines/tinsel/dialogs.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Oct 26 11:40:51 CET 2009


Revision: 45400
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45400&view=rev
Author:   fingolfin
Date:     2009-10-26 10:40:51 +0000 (Mon, 26 Oct 2009)

Log Message:
-----------
TINSEL: cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/tinsel/dialogs.cpp

Modified: scummvm/trunk/engines/tinsel/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/dialogs.cpp	2009-10-26 10:40:35 UTC (rev 45399)
+++ scummvm/trunk/engines/tinsel/dialogs.cpp	2009-10-26 10:40:51 UTC (rev 45400)
@@ -1263,31 +1263,29 @@
  * Convert item ID number to pointer to item's compiled data
  * i.e. Image data and Glitter code.
  */
-INV_OBJECT *GetInvObject(int num) {
-	INV_OBJECT *retval = invObjects;
+INV_OBJECT *GetInvObject(int id) {
+	INV_OBJECT *pObject = invObjects;
 
-	for (int i = 0; i < numObjects; i++, retval++) {
-		if (retval->id == num)
-			return retval;
+	for (int i = 0; i < numObjects; i++, pObject++) {
+		if (pObject->id == id)
+			return pObject;
 	}
 
-	error("Trying to manipulate undefined inventory icon");
+	error("GetInvObject(%d): Trying to manipulate undefined inventory icon", id);
 }
 
 /**
  * Convert item ID number to index.
  */
 int GetObjectIndex(int id) {
-	int i;				// Loop counter
-	INV_OBJECT *pObject;
+	INV_OBJECT *pObject = invObjects;
 
-	for (i = 0, pObject = invObjects; i < numObjects; i++, pObject++) {
+	for (int i = 0; i < numObjects; i++, pObject++) {
 		if (pObject->id == id)
-			break;
+			return i;
 	}
 
-	assert(i < numObjects);
-	return i;
+	error("GetObjectIndex(%d): Trying to manipulate undefined inventory icon", id);
 }
 
 /**


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