diff options
author | Nicola Mettifogo | 2010-02-08 16:13:09 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2010-02-08 16:13:09 +0000 |
commit | 1fe0facb2447ea62b9b8dcb03a2a879de24fc51f (patch) | |
tree | 08c32b7ca6b3a1cb0a3487ef594d472dd29ab8fc /engines/drascula/drascula.cpp | |
parent | 0b06fb2a88aa33e6f74b42de84aa3a1f4f9b87ac (diff) | |
download | scummvm-rg350-1fe0facb2447ea62b9b8dcb03a2a879de24fc51f.tar.gz scummvm-rg350-1fe0facb2447ea62b9b8dcb03a2a879de24fc51f.tar.bz2 scummvm-rg350-1fe0facb2447ea62b9b8dcb03a2a879de24fc51f.zip |
Pass the input stream to text parser functions.
svn-id: r47992
Diffstat (limited to 'engines/drascula/drascula.cpp')
-rw-r--r-- | engines/drascula/drascula.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 3920f8a56c..824a5eb2dd 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -604,15 +604,15 @@ bool DrasculaEngine::runCurrentChapter() { } } -char *DrasculaEngine::getLine(char *buf, int len) { +char *DrasculaEngine::getLine(Common::SeekableReadStream &stream, char *buf, int len) { byte c; char *b; for (;;) { b = buf; while (true) { - c = ~_arj.readByte(); - if (_arj.eos()) break; + c = ~stream.readByte(); + if (stream.eos()) break; if (c == '\r') continue; @@ -621,7 +621,7 @@ char *DrasculaEngine::getLine(char *buf, int len) { *b++ = c; } *b = '\0'; - if (_arj.eos() && b == buf) + if (stream.eos() && b == buf) return NULL; if (b != buf) break; @@ -629,13 +629,15 @@ char *DrasculaEngine::getLine(char *buf, int len) { return buf; } -void DrasculaEngine::getIntFromLine(char *buf, int len, int* result) { - getLine(buf, len); +void DrasculaEngine::getIntFromLine(Common::SeekableReadStream &stream, int len, int* result) { + char buf[256]; + getLine(stream, buf, len); sscanf(buf, "%d", result); } -void DrasculaEngine::getStringFromLine(char *buf, int len, char* result) { - getLine(buf, len); +void DrasculaEngine::getStringFromLine(Common::SeekableReadStream &stream, int len, char* result) { + char buf[256]; + getLine(stream, buf, len); sscanf(buf, "%s", result); } |