diff options
author | Andre Heider | 2010-09-15 07:43:34 +0000 |
---|---|---|
committer | Andre Heider | 2010-09-15 07:43:34 +0000 |
commit | 76ca653972f5513d46c00889b57c7a13e41859a9 (patch) | |
tree | 00d72f6cd53f39006b13b6601dc7ec00e1c705af | |
parent | 41834499edb64965058dea33f1a3176810c52d88 (diff) | |
download | scummvm-rg350-76ca653972f5513d46c00889b57c7a13e41859a9.tar.gz scummvm-rg350-76ca653972f5513d46c00889b57c7a13e41859a9.tar.bz2 scummvm-rg350-76ca653972f5513d46c00889b57c7a13e41859a9.zip |
PLUGINS: Don't expect every plugin to load.
svn-id: r52729
-rw-r--r-- | base/plugins.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp index b14783abee..2e08dabc3f 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -335,32 +335,34 @@ void PluginManager::loadFirstPlugin() { //TODO: rename? It's not quite clear tha } //this loop is for loading all non-engine plugins and the first engine plugin. - while (true) { - assert(tryLoadPlugin(*_currentPlugin)); - if ((*_currentPlugin)->getType() == PLUGIN_TYPE_ENGINE) { //TODO: This assumes all non-engine plugins will precede the first engine plugin! + for (; _currentPlugin != _allPlugs.end(); ++_currentPlugin) { + if (!tryLoadPlugin(*_currentPlugin)) + continue; + + // TODO: This assumes all non-engine plugins will precede the first engine plugin! + if ((*_currentPlugin)->getType() == PLUGIN_TYPE_ENGINE) break; - } + _nonEnginePlugs++; - ++_currentPlugin; - if (_currentPlugin == _allPlugs.end()) { - break; //break if there were no engine plugins to load. - } } + return; } bool PluginManager::loadNextPlugin() { if (_nonEnginePlugs == _allPlugs.size()) return false; //There are no Engine Plugins in this case. - //To ensure only one engine plugin is loaded at a time, we unload all engine plugins before trying to load a new one. + + // To ensure only one engine plugin is loaded at a time, we unload all engine plugins before trying to load a new one. unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL); + ++_currentPlugin; - if (_currentPlugin == _allPlugs.end()) { - loadFirstPlugin(); //load first engine plugin again at this point. - return false; - } - assert(tryLoadPlugin(*_currentPlugin)); - return true; + for (; _currentPlugin != _allPlugs.end(); ++_currentPlugin) + if (tryLoadPlugin(*_currentPlugin)) + return true; + + loadFirstPlugin(); + return false; } void PluginManager::loadPlugins() { |