aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2008-06-05 20:35:45 +0000
committerEugene Sandulenko2008-06-05 20:35:45 +0000
commitb7ac2f99f623b09c218884c490a8f3cb95eef77e (patch)
treec794bb8f8c757a489bb178aa786bfc27ddad88ef /engines
parent35cdc7aae478f55765bf213b0f929d0ba34cac8f (diff)
downloadscummvm-rg350-b7ac2f99f623b09c218884c490a8f3cb95eef77e.tar.gz
scummvm-rg350-b7ac2f99f623b09c218884c490a8f3cb95eef77e.tar.bz2
scummvm-rg350-b7ac2f99f623b09c218884c490a8f3cb95eef77e.zip
Optimize a bit roomParse, though ideal would be a binary search, but I am
too lazy for that. svn-id: r32561
Diffstat (limited to 'engines')
-rw-r--r--engines/drascula/rooms.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/engines/drascula/rooms.cpp b/engines/drascula/rooms.cpp
index ea6b7766e2..968cf1952b 100644
--- a/engines/drascula/rooms.cpp
+++ b/engines/drascula/rooms.cpp
@@ -154,8 +154,11 @@ void DrasculaEngine::setupRoomsTable() {
}
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 @@ bool DrasculaEngine::roomParse(int room, int fl) {
}
}
}
- }
+ } else if (seen) // Stop searching down the list
+ break;
}
return false;