aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/journal.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-04-25 03:05:51 -0500
committerPaul Gilbert2015-04-25 03:05:51 -0500
commitbaeca76b028ff846ce14bad4575984324fd4c999 (patch)
treee4070809d4acda69c8b50b26881c0cb4fc1a50ee /engines/sherlock/journal.cpp
parentc92b3b5c71666797eb6d26008ebbfd88d69573c3 (diff)
downloadscummvm-rg350-baeca76b028ff846ce14bad4575984324fd4c999.tar.gz
scummvm-rg350-baeca76b028ff846ce14bad4575984324fd4c999.tar.bz2
scummvm-rg350-baeca76b028ff846ce14bad4575984324fd4c999.zip
SHERLOCK: Fix crash displaying journal contents for Lestrade
Diffstat (limited to 'engines/sherlock/journal.cpp')
-rw-r--r--engines/sherlock/journal.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp
index e3d4e1b7a3..1891419acf 100644
--- a/engines/sherlock/journal.cpp
+++ b/engines/sherlock/journal.cpp
@@ -248,6 +248,7 @@ int Journal::loadJournalFile(bool alreadyLoaded) {
if (c < 128) {
// Nope. Set flag for allowing control coes to insert spaces
ctrlSpace = true;
+ assert(c >= ' ');
// Check for embedded comments
if (c == '{' || c == '}') {
@@ -307,7 +308,7 @@ int Journal::loadJournalFile(bool alreadyLoaded) {
journalString += c;
do {
journalString += *replyP++;
- } while (*replyP && *replyP < 128 && *replyP != '{' && *replyP != '}');
+ } while (*replyP && (byte)*replyP < 128 && *replyP != '{' && *replyP != '}');
commentJustPrinted = false;
}
@@ -323,16 +324,16 @@ int Journal::loadJournalFile(bool alreadyLoaded) {
}
startOfReply = false;
- c = *replyP++;
+ c = *replyP++ - 1;
- if ((c - 1) == 0)
+ if (c == 0)
journalString += "Holmes";
- else if ((c - 1) == 1)
+ else if (c == 1)
journalString += "I";
- else if ((c - 1) == 2)
+ else if (c == 2)
journalString += "the Inspector";
else
- journalString += inv._names[c - 1];
+ journalString += NAMES[c];
const char *strP = replyP;
char v;
@@ -352,7 +353,7 @@ int Journal::loadJournalFile(bool alreadyLoaded) {
case 131: // Pause with control
case 136: // Pause without control
case 157: // Walk to canimation
- // These commands don't have any param
+ // These commands have a single parameter
++replyP;
break;
@@ -821,7 +822,7 @@ bool Journal::handleEvents(int key) {
} else {
color = COMMAND_FOREGROUND;
}
- screen.buttonPrint(Common::Point(JOURNAL_POINTS[1][2], JOURNAL_BUTTONS_Y), color, true, "Exit");
+ screen.buttonPrint(Common::Point(JOURNAL_POINTS[0][2], JOURNAL_BUTTONS_Y), color, true, "Exit");
// Back 10 button
if (pt.x > JOURNAL_POINTS[1][0] && pt.x < JOURNAL_POINTS[1][1] && pt.y >= JOURNAL_BUTTONS_Y &&