Skip to content

Commit

Permalink
PINK: change linear search to binary
Browse files Browse the repository at this point in the history
  • Loading branch information
voltya authored and sev- committed Jun 28, 2018
1 parent b82c0ee commit a8baeda
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions engines/pink/resource_mgr.cpp
Expand Up @@ -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();
Expand Down

0 comments on commit a8baeda

Please sign in to comment.