From a0c5805c8efba2e184b737dc7869092318743004 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 5 May 2014 20:31:21 +0200 Subject: CGE2: Read identifiers properly in Text::load(). --- engines/cge2/fileio.cpp | 8 ++++++++ engines/cge2/fileio.h | 1 + engines/cge2/text.cpp | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/engines/cge2/fileio.cpp b/engines/cge2/fileio.cpp index 4da2c52cfa..fb39cd3ad7 100644 --- a/engines/cge2/fileio.cpp +++ b/engines/cge2/fileio.cpp @@ -232,6 +232,14 @@ Common::String EncryptedStream::readLine() { return _readStream->readLine(); } +int EncryptedStream::number(char *s) { + int r = atoi(s); + char *pp = strchr(s, ':'); + if (pp) + r = (r << 8) + atoi(pp + 1); + return r; +} + int32 EncryptedStream::size() { return _readStream->size(); } diff --git a/engines/cge2/fileio.h b/engines/cge2/fileio.h index 42bb2ee352..0597c6ac08 100644 --- a/engines/cge2/fileio.h +++ b/engines/cge2/fileio.h @@ -113,6 +113,7 @@ public: int32 size(); uint32 read(byte *dataPtr, uint32 dataSize); Common::String readLine(); + int number(char *s); }; } // End of namespace CGE2 diff --git a/engines/cge2/text.cpp b/engines/cge2/text.cpp index e65c19f202..de33717c55 100644 --- a/engines/cge2/text.cpp +++ b/engines/cge2/text.cpp @@ -107,7 +107,7 @@ void Text::load() { if (!Common::isDigit(*s)) continue; - int r = atoi(s); + int r = tf.number(s); s += strlen(s); if (s < tmpStr + n) -- cgit v1.2.3