aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMatthew Hoops2010-01-27 21:43:23 +0000
committerMatthew Hoops2010-01-27 21:43:23 +0000
commit898135b7d0642fd3464b734f9b21d083d90bc983 (patch)
treeb3b0a468c00d086e8a780162bb99f16916e31298 /engines
parent90712388f88ea6279ddb9bad668335c4bbc2f60c (diff)
downloadscummvm-rg350-898135b7d0642fd3464b734f9b21d083d90bc983.tar.gz
scummvm-rg350-898135b7d0642fd3464b734f9b21d083d90bc983.tar.bz2
scummvm-rg350-898135b7d0642fd3464b734f9b21d083d90bc983.zip
SearchMan.listMatchingMembers does not return files in alphabetical order, so we can't rely on the order of the lists. Rework the SCI2.1+ loading code to iterate through both lists in nested loops to fix multi-archive SCI2.1 games (such as GK2).
svn-id: r47612
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/resource.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index a50f67ffbf..3bf9153be0 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -408,19 +408,19 @@ int ResourceManager::addAppropriateSources() {
if (mapFiles.empty() || files.empty() || mapFiles.size() != files.size())
return 0;
- Common::ArchiveMemberList::const_iterator fileIterator = files.begin();
- Common::ArchiveMemberList::const_iterator mapIterator = mapFiles.begin();
-
- while (fileIterator != files.end()) {
+ for (Common::ArchiveMemberList::const_iterator mapIterator = mapFiles.begin(); mapIterator != mapFiles.end(); ++mapIterator) {
Common::String mapName = (*mapIterator)->getName();
- Common::String resName = (*fileIterator)->getName();
+ int mapNumber = atoi(strrchr(mapName.c_str(), '.') + 1);
- const char *dot = strrchr(mapName.c_str(), '.');
- int number = atoi(dot + 1);
+ for (Common::ArchiveMemberList::const_iterator fileIterator = files.begin(); fileIterator != files.end(); ++fileIterator) {
+ Common::String resName = (*fileIterator)->getName();
+ int resNumber = atoi(strrchr(resName.c_str(), '.') + 1);
- addSource(addExternalMap(mapName.c_str(), number), kSourceVolume, resName.c_str(), number);
- ++fileIterator;
- ++mapIterator;
+ if (mapNumber == resNumber) {
+ addSource(addExternalMap(mapName.c_str(), mapNumber), kSourceVolume, resName.c_str(), mapNumber);
+ break;
+ }
+ }
}
}
#else