From 3a6063bc7a0fdaf16f16d99656bbe2b657c466e5 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sun, 15 Jan 2012 15:54:16 +0100 Subject: [PATCH] Fix inability to go to a higher page in a book than the next after what has already been displayed. Fixes books on the Relto bookshelf not remembering their last open page beyond the second. --- Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp index 91a40e62..825904db 100644 --- a/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp +++ b/Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp @@ -1744,10 +1744,8 @@ void pfJournalBook::IHandleCheckClick( UInt32 idx, pfBookData::WhichSide whic void pfJournalBook::GoToPage( UInt32 pageNumber ) { // Put us here, but only on an even page (odd pages go on the right, y'know) - if (pageNumber < fPageStarts.Count()) - fCurrentPage = pageNumber & ~0x00000001; - else - fCurrentPage = 0; + // (no need for a range check, going past the end simply puts you on a blank page, able to go backward but not forward) + fCurrentPage = pageNumber & ~0x00000001; fVisibleLinks.Reset(); IRenderPage( fCurrentPage, pfJournalDlgProc::kTagLeftDTMap ); IRenderPage( fCurrentPage + 1, pfJournalDlgProc::kTagRightDTMap ); @@ -2610,7 +2608,7 @@ void pfJournalBook::IRenderPage( UInt32 page, UInt32 whichDTMap, hsBool suppr } } - hsAssert(page < fPageStarts.GetCount(), "UnInitialized page start!"); + hsAssert(page < fPageStarts.GetCount() || page > fLastPage, "UnInitialized page start!"); if( page <= fLastPage && page < fPageStarts.GetCount()) // Added this as a crash-prevention bandaid - MT {