[Scummvm-cvs-logs] SF.net SVN: scummvm: [21538] scummvm/trunk/engines/sword2/startup.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Sat Apr 1 13:57:00 CEST 2006


Revision: 21538
Author:   eriktorbjorn
Date:     2006-04-01 13:56:10 -0800 (Sat, 01 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21538&view=rev

Log Message:
-----------
Simplified loading of startup.inf

Modified Paths:
--------------
    scummvm/trunk/engines/sword2/startup.cpp
Modified: scummvm/trunk/engines/sword2/startup.cpp
===================================================================
--- scummvm/trunk/engines/sword2/startup.cpp	2006-04-01 21:55:45 UTC (rev 21537)
+++ scummvm/trunk/engines/sword2/startup.cpp	2006-04-01 21:56:10 UTC (rev 21538)
@@ -58,38 +58,13 @@
 	// extract the filenames
 
 	int start_ids[MAX_starts];
+	char buf[10];
 
-	while (1) {
-		bool done = false;
-
-		start_ids[_totalScreenManagers] = 0;
-
-		// Scan the string until the LF in CRLF
-
-		int b;
-
-		do {
-			b = fp.readByte();
-
-			if (fp.ioFailed()) {
-				done = true;
-				break;
-			}
-
-			if (isdigit(b)) {
-				start_ids[_totalScreenManagers] *= 10;
-				start_ids[_totalScreenManagers] += (b - '0');
-			}
-		} while (b != 10);
-
-		if (done)
+	while (fp.readLine(buf, sizeof(buf))) {
+		start_ids[_totalScreenManagers] = atoi(buf);
+		if (++_totalScreenManagers >= MAX_starts) {
+			warning("Too many entries in startup.inf");
 			break;
-
-		_totalScreenManagers++;
-
-		if (_totalScreenManagers == MAX_starts) {
-			warning("MAX_starts exceeded");
-			break;
 		}
 	}
 


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