diff options
author | Paul Gilbert | 2015-04-01 23:19:00 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-04-01 23:19:00 -0400 |
commit | 86022c065c1bf7aa67549de602cd6e8933477d74 (patch) | |
tree | ae50b5ebd859841522089a871609cede19830f27 /engines/sherlock | |
parent | c13c02b079d0881b4d1cd205364d043920bab9a5 (diff) | |
download | scummvm-rg350-86022c065c1bf7aa67549de602cd6e8933477d74.tar.gz scummvm-rg350-86022c065c1bf7aa67549de602cd6e8933477d74.tar.bz2 scummvm-rg350-86022c065c1bf7aa67549de602cd6e8933477d74.zip |
SHERLOCK: Implemented Journal::record
Diffstat (limited to 'engines/sherlock')
-rw-r--r-- | engines/sherlock/journal.cpp | 17 |
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() { |