diff options
author | Filippos Karapetis | 2019-08-19 00:16:02 +0300 |
---|---|---|
committer | Filippos Karapetis | 2019-08-19 00:18:02 +0300 |
commit | 8e69e9e462aa5c5b79c4561da8702b76279f5cc9 (patch) | |
tree | 10c3ecdb79bd2b2ce0bc3ba6f7f7702c72424027 | |
parent | 6a9969ed25e485e393cd76fe486d3778b541d0c4 (diff) | |
download | scummvm-rg350-8e69e9e462aa5c5b79c4561da8702b76279f5cc9.tar.gz scummvm-rg350-8e69e9e462aa5c5b79c4561da8702b76279f5cc9.tar.bz2 scummvm-rg350-8e69e9e462aa5c5b79c4561da8702b76279f5cc9.zip |
STARTREK: Fix failed action texts
-rw-r--r-- | engines/startrek/startrek.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/engines/startrek/startrek.cpp b/engines/startrek/startrek.cpp index 2e4a5a0a88..d22c6100c3 100644 --- a/engines/startrek/startrek.cpp +++ b/engines/startrek/startrek.cpp @@ -628,18 +628,25 @@ Common::String StarTrekEngine::getLoadedText(int textIndex) { Common::String str; byte cur; - while (textIndex != 0) { + int curIndex = 0; + + while (!txtFile->eos()) { do { cur = txtFile->readByte(); - if (cur != '\0') - str += cur; + str += cur; } while (cur != '\0'); - textIndex--; - } - delete txtFile; + if (curIndex == textIndex) { + delete txtFile; + return str; + } - return str; + curIndex++; + str = ""; + } + + delete txtFile; + return ""; } } // End of namespace StarTrek |