From bcfe38c24f032715e732422069f25ae5ef1f2a81 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 26 Jul 2015 21:51:18 -0400 Subject: SHERLOCK: RT: Move Journal record method back to Journal class --- engines/sherlock/journal.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'engines/sherlock/journal.cpp') 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); -- cgit v1.2.3