[Scummvm-cvs-logs] SF.net SVN: scummvm:[52729] scummvm/branches/gsoc2010-plugins/base/plugins. cpp

dhewg at users.sourceforge.net dhewg at users.sourceforge.net
Wed Sep 15 09:43:34 CEST 2010


Revision: 52729
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52729&view=rev
Author:   dhewg
Date:     2010-09-15 07:43:34 +0000 (Wed, 15 Sep 2010)

Log Message:
-----------
PLUGINS: Don't expect every plugin to load.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-plugins/base/plugins.cpp

Modified: scummvm/branches/gsoc2010-plugins/base/plugins.cpp
===================================================================
--- scummvm/branches/gsoc2010-plugins/base/plugins.cpp	2010-09-15 07:43:16 UTC (rev 52728)
+++ scummvm/branches/gsoc2010-plugins/base/plugins.cpp	2010-09-15 07:43:34 UTC (rev 52729)
@@ -335,32 +335,34 @@
 	}
 
 	//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() {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list