diff options
author | whiterandrek | 2018-05-22 07:01:54 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | ea5c09341013805e3be3a40d96a54baa7548b5d0 (patch) | |
tree | 2bea7dd9f013166030c5f418a5ef9361a7cce131 /engines | |
parent | c06452594f13c93fe2d21f61e04a99d430ced65b (diff) | |
download | scummvm-rg350-ea5c09341013805e3be3a40d96a54baa7548b5d0.tar.gz scummvm-rg350-ea5c09341013805e3be3a40d96a54baa7548b5d0.tar.bz2 scummvm-rg350-ea5c09341013805e3be3a40d96a54baa7548b5d0.zip |
PINK: remove lambda functions
PINK: remove lambda functions
PINK: remove >> << operators
Diffstat (limited to 'engines')
-rw-r--r-- | engines/pink/archive.cpp | 11 | ||||
-rw-r--r-- | engines/pink/file.cpp | 8 | ||||
-rw-r--r-- | engines/pink/objects/module.cpp | 9 | ||||
-rw-r--r-- | engines/pink/objects/sequences/sequencer.cpp | 9 | ||||
-rw-r--r-- | engines/pink/resource_mgr.cpp | 10 |
5 files changed, 26 insertions, 21 deletions
diff --git a/engines/pink/archive.cpp b/engines/pink/archive.cpp index a3c968b4dd..caaca5f749 100644 --- a/engines/pink/archive.cpp +++ b/engines/pink/archive.cpp @@ -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; } diff --git a/engines/pink/file.cpp b/engines/pink/file.cpp index 72de8ebdea..a62a9d83e2 100644 --- a/engines/pink/file.cpp +++ b/engines/pink/file.cpp @@ -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; } diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp index 9ad536530c..019f71ba30 100644 --- a/engines/pink/objects/module.cpp +++ b/engines/pink/objects/module.cpp @@ -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 { diff --git a/engines/pink/objects/sequences/sequencer.cpp b/engines/pink/objects/sequences/sequencer.cpp index 37cd03cd37..5644aa8f25 100644 --- a/engines/pink/objects/sequences/sequencer.cpp +++ b/engines/pink/objects/sequences/sequencer.cpp @@ -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) { diff --git a/engines/pink/resource_mgr.cpp b/engines/pink/resource_mgr.cpp index bbf7e7e04a..9c72fc7b92 100644 --- a/engines/pink/resource_mgr.cpp +++ b/engines/pink/resource_mgr.cpp @@ -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(); |