diff options
author | Paul Gilbert | 2015-07-26 21:51:18 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-07-26 21:51:18 -0400 |
commit | bcfe38c24f032715e732422069f25ae5ef1f2a81 (patch) | |
tree | 3929434d5d5dc121c7224240fe0370c923f171d4 /engines/sherlock/journal.cpp | |
parent | 6f121be1c26adb406e204c1644cf1f5c8b3960e8 (diff) | |
download | scummvm-rg350-bcfe38c24f032715e732422069f25ae5ef1f2a81.tar.gz scummvm-rg350-bcfe38c24f032715e732422069f25ae5ef1f2a81.tar.bz2 scummvm-rg350-bcfe38c24f032715e732422069f25ae5ef1f2a81.zip |
SHERLOCK: RT: Move Journal record method back to Journal class
Diffstat (limited to 'engines/sherlock/journal.cpp')
-rw-r--r-- | engines/sherlock/journal.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp index 9441d6682a..44b24066d3 100644 --- a/engines/sherlock/journal.cpp +++ b/engines/sherlock/journal.cpp @@ -683,6 +683,37 @@ void Journal::loadJournalFile(bool alreadyLoaded) { } } +void Journal::record(int converseNum, int statementNum, bool replyOnly) { + int saveIndex = _index; + int saveSub = _sub; + + if (IS_3DO) { + // there seems to be no journal in the 3DO version + return; + } + + // Record the entry into the list + _journal.push_back(JournalEntry(converseNum, statementNum, replyOnly)); + _index = _journal.size() - 1; + + // Load the text for the new entry to get the number of lines it will have + loadJournalFile(true); + + // 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 (!_lines.empty()) { + _maxPage += _lines.size(); + } else { + // No lines in entry, so remove the new entry from the journal + _journal.remove_at(_journal.size() - 1); + } +} + + void Journal::synchronize(Serializer &s) { s.syncAsSint16LE(_index); s.syncAsSint16LE(_sub); |