diff options
author | uruk | 2014-05-26 16:30:32 +0200 |
---|---|---|
committer | uruk | 2014-05-26 16:30:32 +0200 |
commit | 62e36f92793efea211715f65c7845baa95c16135 (patch) | |
tree | 9bec45c665860c37a3b4757960dcadfc6979771b /engines | |
parent | 43ce991b84b75b290a9098c940a3d5294ff3eb66 (diff) | |
download | scummvm-rg350-62e36f92793efea211715f65c7845baa95c16135.tar.gz scummvm-rg350-62e36f92793efea211715f65c7845baa95c16135.tar.bz2 scummvm-rg350-62e36f92793efea211715f65c7845baa95c16135.zip |
CGE2: Rework EncryptedStream::readLine().
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cge2/cge2_main.cpp | 14 | ||||
-rw-r--r-- | engines/cge2/fileio.cpp | 5 | ||||
-rw-r--r-- | engines/cge2/fileio.h | 1 | ||||
-rw-r--r-- | engines/cge2/vga13h.cpp | 5 |
4 files changed, 14 insertions, 11 deletions
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp index 3f8f8623e6..eea59a4a4b 100644 --- a/engines/cge2/cge2_main.cpp +++ b/engines/cge2/cge2_main.cpp @@ -116,11 +116,10 @@ void CGE2Engine::loadSprite(const char *fname, int ref, int scene, V3D &pos) { Common::String line; for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()){ - int len = line.size(); - Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); - if (len == 0 || *tmpStr == ';') + if (line.size() == 0) continue; - + Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); + char *p; p = token(tmpStr); if (*p == '@') { @@ -260,13 +259,14 @@ void CGE2Engine::loadScript(const char *fname) { Common::String line; for (line = scrf.readLine(); !scrf.eos(); line = scrf.readLine()) { + if (line.size() == 0) + continue; + char *p; lcnt++; Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); - if ((line.size() == 0) || (*tmpStr == ';')) // Comments start with ';' - don't bother with them. - continue; - + ok = false; // not OK if break V3D P; diff --git a/engines/cge2/fileio.cpp b/engines/cge2/fileio.cpp index fc6303bbe2..4fec4a67ca 100644 --- a/engines/cge2/fileio.cpp +++ b/engines/cge2/fileio.cpp @@ -242,7 +242,10 @@ bool EncryptedStream::seek(int32 offset) { Common::String EncryptedStream::readLine() { _lineCount++; - return _readStream->readLine(); + Common::String line = _readStream->readLine(); + if (!line.empty() && (line[0] == ';' || line[0] == '.' || line[0] == '*')) + line.clear(); // Returns an empty string, if the line is invalid. + return line; } int32 EncryptedStream::size() { diff --git a/engines/cge2/fileio.h b/engines/cge2/fileio.h index ab5de22d07..83a14560ad 100644 --- a/engines/cge2/fileio.h +++ b/engines/cge2/fileio.h @@ -105,6 +105,7 @@ public: bool exist(const char *name); }; +// TODO: Revise the whole class! class EncryptedStream { private: CGE2Engine *_vm; diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp index bbfd6c471c..d428a10039 100644 --- a/engines/cge2/vga13h.cpp +++ b/engines/cge2/vga13h.cpp @@ -278,10 +278,9 @@ Sprite *Sprite::expand() { char tmpStr[kLineMax + 1]; for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()){ - int len = line.size(); - Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); - if (len == 0 || *tmpStr == ';') + if (line.size() == 0) continue; + Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr)); char *p = _vm->token(tmpStr); if (*p == '@') { |