[Scummvm-cvs-logs] SF.net SVN: scummvm: [32561] scummvm/trunk/engines/drascula/rooms.cpp

sev at users.sourceforge.net sev at users.sourceforge.net
Thu Jun 5 22:35:45 CEST 2008


Revision: 32561
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32561&view=rev
Author:   sev
Date:     2008-06-05 13:35:45 -0700 (Thu, 05 Jun 2008)

Log Message:
-----------
Optimize a bit roomParse, though ideal would be a binary search, but I am
too lazy for that.

Modified Paths:
--------------
    scummvm/trunk/engines/drascula/rooms.cpp

Modified: scummvm/trunk/engines/drascula/rooms.cpp
===================================================================
--- scummvm/trunk/engines/drascula/rooms.cpp	2008-06-05 20:28:50 UTC (rev 32560)
+++ scummvm/trunk/engines/drascula/rooms.cpp	2008-06-05 20:35:45 UTC (rev 32561)
@@ -154,8 +154,11 @@
 }
 
 bool DrasculaEngine::roomParse(int room, int fl) {
+	bool seen = false;
+
 	for (int i = 0; i < ARRAYSIZE(roomActions); i++) {
 		if (roomActions[i].room == room) {
+			seen = true;
 			if (roomActions[i].chapter == currentChapter ||
 				roomActions[i].chapter == -1) {
 				if (roomActions[i].action == pickedObject ||
@@ -168,7 +171,8 @@
 					}
 				}
 			}
-		}
+		} else if (seen) // Stop searching down the list
+			break;
 	}
 
 	return false;


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