diff options
author | Paul Gilbert | 2015-09-21 20:35:20 -0400 |
---|---|---|
committer | Paul Gilbert | 2015-09-21 20:35:20 -0400 |
commit | 4a8ab68327412597b9be2b22990f52d7acaddd2e (patch) | |
tree | d8a761fb130f4cf26727ed377d4aaaf887cbdec6 | |
parent | e704f9aa9d06f61acdc92a0161ff433fcdb8efff (diff) | |
download | scummvm-rg350-4a8ab68327412597b9be2b22990f52d7acaddd2e.tar.gz scummvm-rg350-4a8ab68327412597b9be2b22990f52d7acaddd2e.tar.bz2 scummvm-rg350-4a8ab68327412597b9be2b22990f52d7acaddd2e.zip |
SHERLOCK: RT: Fix trying to scroll journal when there's only a single page
-rw-r--r-- | engines/sherlock/tattoo/tattoo_journal.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/engines/sherlock/tattoo/tattoo_journal.cpp b/engines/sherlock/tattoo/tattoo_journal.cpp index abe3e5420e..e836cca620 100644 --- a/engines/sherlock/tattoo/tattoo_journal.cpp +++ b/engines/sherlock/tattoo/tattoo_journal.cpp @@ -253,9 +253,11 @@ void TattooJournal::handleButtons() { // FIgure out the left of the scrollbar scroll area and paging data const int scrollingWidth = JOURNAL_BAR_WIDTH - BUTTON_SIZE * 2 - 6; const int scrollingLeft = (SHERLOCK_SCREEN_WIDTH - JOURNAL_BAR_WIDTH) / 2 + BUTTON_SIZE + 3; - const int numPages = (_maxPage + LINES_PER_PAGE - 1) / LINES_PER_PAGE - 1; - const int barWidth = CLIP(scrollingWidth / numPages, BUTTON_SIZE, JOURNAL_BAR_WIDTH - BUTTON_SIZE * 2 - 6); + const int numPages = (_maxPage + LINES_PER_PAGE - 1) / LINES_PER_PAGE; + if (numPages == 1) + return; + const int barWidth = CLIP(scrollingWidth / numPages, BUTTON_SIZE, JOURNAL_BAR_WIDTH - BUTTON_SIZE * 2 - 6); const int scrollOffset = mousePos.x - scrollingLeft; const int page = scrollOffset * FIXED_INT_MULTIPLIER / ((scrollingWidth - barWidth) * (FIXED_INT_MULTIPLIER / (numPages - 1))) + 1; @@ -556,7 +558,7 @@ void TattooJournal::highlightJournalControls(bool slamIt) { _selector = JH_NONE; } else { // Calculate the Scroll Position Bar - int numPages = (_maxPage + LINES_PER_PAGE - 1) / LINES_PER_PAGE - 1; + int numPages = (_maxPage + LINES_PER_PAGE - 1) / LINES_PER_PAGE; int barWidth = (r.width() - BUTTON_SIZE * 2 - 6) / numPages; barWidth = CLIP(barWidth, BUTTON_SIZE, r.width() - BUTTON_SIZE * 2 - 6); @@ -672,7 +674,7 @@ void TattooJournal::drawScrollBar() { r.moveTo((SHERLOCK_SCREEN_WIDTH - r.width()) / 2, SHERLOCK_SCREEN_HEIGHT - r.height()); // Calculate the Scroll Position Bar - int numPages = (_maxPage + LINES_PER_PAGE - 1) / LINES_PER_PAGE - 1; + int numPages = (_maxPage + LINES_PER_PAGE - 1) / LINES_PER_PAGE; int barWidth = (r.width() - BUTTON_SIZE * 2 - 6) / numPages; barWidth = CLIP(barWidth, BUTTON_SIZE, r.width() - BUTTON_SIZE * 2 - 6); int barX; |