From c4955466fd27eef92c551f630cdef5c51dce1e74 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 1 Apr 2006 21:56:10 +0000 Subject: Simplified loading of startup.inf svn-id: r21538 --- engines/sword2/startup.cpp | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'engines/sword2') 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; } } -- cgit v1.2.3