aboutsummaryrefslogtreecommitdiff
path: root/engines/startrek
diff options
context:
space:
mode:
authorFilippos Karapetis2019-08-19 00:16:02 +0300
committerFilippos Karapetis2019-08-19 00:18:02 +0300
commit8e69e9e462aa5c5b79c4561da8702b76279f5cc9 (patch)
tree10c3ecdb79bd2b2ce0bc3ba6f7f7702c72424027 /engines/startrek
parent6a9969ed25e485e393cd76fe486d3778b541d0c4 (diff)
downloadscummvm-rg350-8e69e9e462aa5c5b79c4561da8702b76279f5cc9.tar.gz
scummvm-rg350-8e69e9e462aa5c5b79c4561da8702b76279f5cc9.tar.bz2
scummvm-rg350-8e69e9e462aa5c5b79c4561da8702b76279f5cc9.zip
STARTREK: Fix failed action texts
Diffstat (limited to 'engines/startrek')
-rw-r--r--engines/startrek/startrek.cpp21
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