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
This commit is contained in:
auria 2011-11-29 18:24:04 +00:00
parent b0b1a7c7a1
commit 83527e9146

View File

@ -767,8 +767,29 @@ void RaceResultGUI::enableGPProgress()
const std::vector<std::string>& 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; i<tracks.size(); i++)
for(size_t i=startTrack; i<endTrack; i++)
{
Track* track = track_manager->getTrack(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);