[Scummvm-cvs-logs] SF.net SVN: scummvm:[45421] scummvm/trunk/tools/create_msvc

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon Oct 26 22:52:11 CET 2009


Revision: 45421
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45421&view=rev
Author:   lordhoto
Date:     2009-10-26 21:52:11 +0000 (Mon, 26 Oct 2009)

Log Message:
-----------
Cleanup.

Modified Paths:
--------------
    scummvm/trunk/tools/create_msvc/create_msvc.cpp
    scummvm/trunk/tools/create_msvc/create_msvc.h

Modified: scummvm/trunk/tools/create_msvc/create_msvc.cpp
===================================================================
--- scummvm/trunk/tools/create_msvc/create_msvc.cpp	2009-10-26 21:41:41 UTC (rev 45420)
+++ scummvm/trunk/tools/create_msvc/create_msvc.cpp	2009-10-26 21:52:11 UTC (rev 45421)
@@ -144,13 +144,11 @@
 				for (EngineDescList::iterator j = setup.engines.begin(); j != setup.engines.end(); ++j)
 					j->enable = true;
 			} else if (!setEngineBuildState(name, setup.engines, true)) {
-				FeatureList::iterator feature = std::find(setup.features.begin(), setup.features.end(), name);
-				if (feature == setup.features.end()) {
+				// If none found, we'll try the features list
+				if (!setFeatureBuildState(name, setup.features, true)) {
 					std::cerr << "ERROR: \"" << name << "\" is neither an engine nor a feature!\n";
 					return -1;
 				}
-
-				feature->enable = true;
 			}
 		} else if (!strncmp(argv[i], "--disable-", 10)) {
 			const char *name = &argv[i][10];
@@ -164,13 +162,10 @@
 					j->enable = false;
 			} else if (!setEngineBuildState(name, setup.engines, false)) {
 				// If none found, we'll try the features list
-				FeatureList::iterator feature = std::find(setup.features.begin(), setup.features.end(), name);
-				if (feature == setup.features.end()) {
+				if (!setFeatureBuildState(name, setup.features, false)) {
 					std::cerr << "ERROR: \"" << name << "\" is neither an engine nor a feature!\n";
 					return -1;
 				}
-
-				feature->enable = false;
 			}
 		} else if (!strcmp(argv[i], "--file-prefix")) {
 			if (i + 1 >= argc) {
@@ -542,6 +537,16 @@
 	return libraries;
 }
 
+bool setFeatureBuildState(const std::string &name, FeatureList &features, bool enable) {
+	FeatureList::iterator i = std::find(features.begin(), features.end(), name);
+	if (i != features.end()) {
+		i->enable = enable;
+		return true;
+	} else {
+		return false;
+	}
+}
+
 namespace {
 typedef std::map<std::string, std::string> UUIDMap;
 

Modified: scummvm/trunk/tools/create_msvc/create_msvc.h
===================================================================
--- scummvm/trunk/tools/create_msvc/create_msvc.h	2009-10-26 21:41:41 UTC (rev 45420)
+++ scummvm/trunk/tools/create_msvc/create_msvc.h	2009-10-26 21:52:11 UTC (rev 45421)
@@ -164,6 +164,17 @@
 StringList getFeatureLibraries(const FeatureList &features);
 
 /**
+ * Sets the state of a given feature. This can be used to
+ * either include or exclude an feature.
+ *
+ * @param name Name of the feature.
+ * @param features List of features to operate on.
+ * @param enable Whether the feature should be enabled or disabled.
+ * @return "true", when it succeeded, "false" otherwise.
+ */
+bool setFeatureBuildState(const std::string &name, FeatureList &features, bool enable);
+
+/**
  * Structure to describe a MSVC build setup.
  *
  * This includes various information about which engines to


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