src/demo.cpp

changeset 39
2c368cf5cc19
parent 38
db677d321cf4
child 41
e985ebb67fdd
--- a/src/demo.cpp	Fri Jun 05 19:13:44 2015 +0300
+++ b/src/demo.cpp	Sat Jun 06 22:03:00 2015 +0300
@@ -76,9 +76,14 @@
 
 static ZandronumVersion findVersion (QString versionName)
 {
-	for (const QVariant& it : getVersions())
+	QList<QVariant> versions = Config::get ("versions").toList();
+
+	for (int i = 0; i < versions.size(); ++i)
 	{
-		ZandronumVersion version = it.value<ZandronumVersion>();
+		if (not versions[i].canConvert<ZandronumVersion>())
+			continue;
+
+		ZandronumVersion version = versions[i].value<ZandronumVersion>();
 
 		if (version.name == versionName
 			or version.name + "M" == versionName
@@ -87,7 +92,7 @@
 			return version;
 		}
 	}
-	
+
 	return ZandronumVersion();
 }
 
@@ -103,9 +108,9 @@
 	{
 		error (tr ("No WAD paths configured!"));
 
-		// Cannot just return an empty string here since that'd trigger
-		// another error prompt - skip ahead and exit.
-		exit (9);
+		// Cannot just return an empty string here since that'd trigger another error prompt - skip
+		// ahead and exit.
+		exit (1);
 	}
 
 	for (int i = 0; i < wadpaths.size(); ++i)
@@ -204,8 +209,8 @@
 		}
 	}
 
-	stream >> headers.length
-	       >> length;
+	stream >> headers.length;
+	stream >> length;
 
 	// The remaining headers are variable and relative to the length header.
 	headers.version = headers.length + 1;

mercurial