PINK: remove lambda functions

PINK: remove lambda functions

PINK: remove >> << operators
This commit is contained in:
whiterandrek 2018-05-22 07:01:54 +03:00 committed by Eugene Sandulenko
parent c06452594f
commit ea5c093410
5 changed files with 26 additions and 21 deletions

View File

@ -302,14 +302,15 @@ Object *Archive::parseObject(bool &isCopyReturned) {
return res;
}
static int runtimeClassCmp(const void *key, const void *elem) {
return strcmp((const char *) key, *(const char **) elem);
}
uint Archive::findObjectId(const char *name) {
RuntimeClass *found = static_cast<RuntimeClass*>
(bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), [] (const void *a, const void *b) {
return strcmp((const char *) a, *(const char **) b);
}));
RuntimeClass *found = (RuntimeClass*) bsearch(name, classMap, sizeof(classMap) / sizeof(RuntimeClass) , sizeof(RuntimeClass), runtimeClassCmp);
if (!found)
error("Class %s is not in class Map", name);
error("Class %s is not in class Map", name);
return found->id;
}

View File

@ -99,10 +99,12 @@ void OrbFile::seekToObject(const char *name) {
seek(desc->objectsOffset);
}
static int objDescComp(const void *a, const void *b) {
return scumm_stricmp((char *) a, (char *) b);
}
ObjectDescription *OrbFile::getObjDesc(const char *name){
ObjectDescription *desc = static_cast<ObjectDescription*>(bsearch(name, _table, _tableSize, sizeof(ObjectDescription),
[] (const void *a, const void *b) {
return scumm_stricmp((char *) a, (char *) b); }));
ObjectDescription *desc = (ObjectDescription*) bsearch(name, _table, _tableSize, sizeof(ObjectDescription), objDescComp);
assert(desc != nullptr);
return desc;
}

View File

@ -76,10 +76,11 @@ void Module::changePage(const Common::String &pageName) {
}
GamePage *Module::findPage(const Common::String &pageName) const {
return *Common::find_if(_pages.begin(), _pages.end(), [&pageName]
(GamePage* page) {
return pageName == page->getName();
});
for (uint i = 0; i < _pages.size(); ++i) {
if (_pages[i]->getName() == pageName)
return _pages[i];
}
return nullptr;
}
PinkEngine *Module::getGame() const {

View File

@ -49,10 +49,11 @@ void Sequencer::deserialize(Archive &archive) {
}
Sequence *Sequencer::findSequence(const Common::String &name) {
return *Common::find_if(_sequences.begin(), _sequences.end(), [&name]
(Sequence* sequence) {
return name == sequence->getName();
});
for (uint i = 0; i < _sequences.size(); ++i) {
if (_sequences[i]->getName() == name)
return _sequences[i];
}
return nullptr;
}
void Sequencer::authorSequence(Sequence *sequence, bool unk) {

View File

@ -56,11 +56,11 @@ Sound *ResourceMgr::loadSound(Common::String &name) {
Common::SafeSeekableSubReadStream *ResourceMgr::getResourceStream(Common::String &name) {
Common::SeekableReadStream *stream;
const ResourceDescription &desc = *Common::find_if(_resDescTable, _resDescTable + _resCount,
[&] (const ResourceDescription &desc) {
return name.compareToIgnoreCase(desc.name) == 0;
});
ResourceDescription &desc = _resDescTable[0];
for (uint i = 0; i < _resCount; ++i) {
if (name.compareToIgnoreCase(_resDescTable[i].name) == 0)
desc = _resDescTable[i];
}
if (desc.inBro)
stream = _game->getBro();