aboutsummaryrefslogtreecommitdiff
path: root/engines/sword2
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-04-01 21:56:10 +0000
committerTorbjörn Andersson2006-04-01 21:56:10 +0000
commitc4955466fd27eef92c551f630cdef5c51dce1e74 (patch)
treec8b5926726ed72b72d278c3d2c9178f80bba0fd9 /engines/sword2
parent0ee4f304b87f76a565a98bd724fae0844a6f5dc7 (diff)
downloadscummvm-rg350-c4955466fd27eef92c551f630cdef5c51dce1e74.tar.gz
scummvm-rg350-c4955466fd27eef92c551f630cdef5c51dce1e74.tar.bz2
scummvm-rg350-c4955466fd27eef92c551f630cdef5c51dce1e74.zip
Simplified loading of startup.inf
svn-id: r21538
Diffstat (limited to 'engines/sword2')
-rw-r--r--engines/sword2/startup.cpp35
1 files changed, 5 insertions, 30 deletions
diff --git a/engines/sword2/startup.cpp b/engines/sword2/startup.cpp
index 1a847f95bf..45906dffa3 100644
--- a/engines/sword2/startup.cpp
+++ b/engines/sword2/startup.cpp
@@ -58,37 +58,12 @@ bool Sword2Engine::initStartMenu() {
// 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)
- break;
-
- _totalScreenManagers++;
-
- if (_totalScreenManagers == MAX_starts) {
- warning("MAX_starts exceeded");
+ while (fp.readLine(buf, sizeof(buf))) {
+ start_ids[_totalScreenManagers] = atoi(buf);
+ if (++_totalScreenManagers >= MAX_starts) {
+ warning("Too many entries in startup.inf");
break;
}
}