|
From: Peque <ms...@us...> - 2010-03-15 11:29:28
|
Module: performous
Branch: master
Commit: 7283e6a12cd19ebd54b228d9036bc969a4ba6f28
Author: Miguel Sánchez de León Peque <msd...@gm...>
Date: Mon Mar 15 02:40:54 2010 +0100
Fixed last bug. Performous wont crash while scrolling hiscores.
---
game/database.cc | 8 +++-----
game/screen_songs.cc | 2 +-
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/game/database.cc b/game/database.cc
index b478125..4668d26 100644
--- a/game/database.cc
+++ b/game/database.cc
@@ -128,11 +128,9 @@ void Database::queryPerSongHiscore_HiscoreDisplay (std::ostream & os, boost::sha
os << "Be the first to be listed here!\n";
return;
}
-
- if (hi.size()-(start_pos+1) < max_displayed) {
- if (hi.size() < 6) start_pos = 0;
- else start_pos -= 1;
- }
+
+ if((hi.size() > 5)&&(start_pos > hi.size()-6)) start_pos = hi.size()-5;
+ else start_pos = 0;
for (size_t i=0; ((i<hi.size())&&(i<max_displayed)); ++i)
{
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index 6d7e473..aef4500 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -79,7 +79,7 @@ void ScreenSongs::manageEvent(SDL_Event event) {
if (nav == input::CANCEL || m_songs.empty()) show_hiscores = false;
else if ((nav == input::UP)&&(hiscore_start_pos > 0)) hiscore_start_pos--;
else if (nav == input::DOWN) hiscore_start_pos++;
- else if ((nav == input::MOREUP)&&(hiscore_start_pos > 4)) hiscore_start_pos -= 5;
+ else if (nav == input::MOREUP) (hiscore_start_pos > 4) ? hiscore_start_pos -= 5 : hiscore_start_pos = 0;
else if (nav == input::MOREDOWN) hiscore_start_pos += 5;
else if (nav == input::LEFT) { m_songs.advance(-1); hiscore_start_pos=0; }
else if (nav == input::RIGHT) { m_songs.advance(1); hiscore_start_pos=0; }
|