From 83527e91469118e52fb5b5b933942d0989383771 Mon Sep 17 00:00:00 2001 From: auria Date: Tue, 29 Nov 2011 18:24:04 +0000 Subject: [PATCH] Apply patch by Wardje to fix displaying GP progress when there are too many tracks git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10275 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/states_screens/race_result_gui.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index 1d5db2f1b..3b04dbe43 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -767,8 +767,29 @@ void RaceResultGUI::enableGPProgress() const std::vector& tracks = race_manager->getGrandPrix()->getTracks(); size_t currentTrack = race_manager->getTrackNumber(); + + // Assume 5 is the max amount we can render in any given height + size_t startTrack = 0; + size_t endTrack = tracks.size(); + if (tracks.size() > 5) + { + if (currentTrack == 0) + { + startTrack = 0; + endTrack = 5; + } + else if (currentTrack + 4 > tracks.size()) + { + startTrack = tracks.size() - 5; + endTrack = tracks.size(); + } + else { + startTrack = currentTrack - 1; + endTrack = currentTrack + 4; + } + } - for(size_t i=0; igetTrack(tracks[i]); GUIEngine::IconButtonWidget* m_screenshot_widget = @@ -779,7 +800,8 @@ void RaceResultGUI::enableGPProgress() m_screenshot_widget->setCustomAspectRatio(4.0f / 3.0f); m_screenshot_widget->m_x = (int)(UserConfigParams::m_width*0.67); m_screenshot_widget->m_y = - (int)(UserConfigParams::m_height*(0.10+i*0.135)); + (int)(UserConfigParams::m_height + * (0.10+(i-startTrack)*0.135)); m_screenshot_widget->m_w = (int)(UserConfigParams::m_width*0.17); m_screenshot_widget->m_h = (int)(UserConfigParams::m_height*0.1275);