aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sherlock/journal.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp
index a9eb86bf07..dcddddbbbd 100644
--- a/engines/sherlock/journal.cpp
+++ b/engines/sherlock/journal.cpp
@@ -52,10 +52,23 @@ void Journal::record(int converseNum, int statementNum) {
// Record the entry into the list
_data.push_back(JournalEntry(converseNum, statementNum));
+ _index = _data.size() - 1;
- bool newLines = loadJournalFile(true);
+ // Load the text for the new entry to get the number of lines it will have
+ int newLines = loadJournalFile(true);
- // TODO
+ // Restore old state
+ _index = saveIndex;
+ _sub = saveSub;
+
+ // If new lines were added to the ournal, update the total number of lines
+ // the journal continues
+ if (newLines) {
+ _maxPage += newLines;
+ } else {
+ // No lines in entry, so remove the new entry from the journal
+ _data.remove_at(_data.size() - 1);
+ }
}
void Journal::loadJournalLocations() {