aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwhiterandrek2018-05-22 22:26:17 +0300
committerEugene Sandulenko2018-06-28 23:51:32 +0200
commita8baeda59e7b4ddff74d8dbe9739db6b22294978 (patch)
tree3b2351dd0523c3f2c276f0360edf9f9e54c95560
parentb82c0eee57c97a716a943ac55a8a6e3404be0f71 (diff)
downloadscummvm-rg350-a8baeda59e7b4ddff74d8dbe9739db6b22294978.tar.gz
scummvm-rg350-a8baeda59e7b4ddff74d8dbe9739db6b22294978.tar.bz2
scummvm-rg350-a8baeda59e7b4ddff74d8dbe9739db6b22294978.zip
PINK: change linear search to binary
-rw-r--r--engines/pink/resource_mgr.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp
index 0981d8e167..8f807c2356 100644
--- a/engines/pink/resource_mgr.cpp
+++ b/engines/pink/resource_mgr.cpp
@@ -52,14 +52,14 @@ Sound *ResourceMgr::loadSound(Common::String &name) {
return new Sound(_game->_mixer, getResourceStream(name));
}
+static int resDescComp(const void *a, const void *b) {
+ return scumm_stricmp((char *) a, (char *) b);
+}
+
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) {
Common::SeekableReadStream *stream;
- ResourceDescription *desc;
- for (uint i = 0; i < _resCount; ++i) {
- if (name.compareToIgnoreCase(_resDescTable[i].name) == 0)
- desc = &_resDescTable[i];
- }
+ ResourceDescription *desc = (ResourceDescription*) bsearch(name.c_str(), _resDescTable, _resCount, sizeof(ResourceDescription), resDescComp);
if (desc->inBro)
stream = _game->getBro();