Display continue button only if next track isn't first available in GP.

Fixed a crash.
This commit is contained in:
Deve 2015-01-07 21:15:53 +01:00
parent b726b59427
commit 2d9e38f7f6
2 changed files with 5 additions and 3 deletions

View File

@ -376,6 +376,7 @@ void RaceManager::startNew(bool from_overworld)
init_gp_rank ++;
}
m_track_number = 0;
if (m_major_mode == MAJOR_MODE_GRAND_PRIX)
{
if (m_continue_saved_gp)
@ -385,7 +386,6 @@ void RaceManager::startNew(bool from_overworld)
}
else
{
m_track_number = 0;
while (m_saved_gp != NULL)
{
m_saved_gp->remove();
@ -538,7 +538,7 @@ void RaceManager::next()
void RaceManager::saveGP()
{
// If Player 1 has already saved a GP, we adapt it
if(m_saved_gp != NULL)
if (m_saved_gp != NULL)
{
m_saved_gp->setKarts(m_kart_status);
m_saved_gp->setNextTrack(m_track_number);

View File

@ -136,9 +136,11 @@ void GPInfoScreen::beforeAddingWidget()
m_gp.getId(),
race_manager->getNumLocalPlayers());
bool continue_visible = saved_gp && saved_gp->getNextTrack() > 0;
RibbonWidget* ribbonButtons = getWidget<RibbonWidget>("buttons");
int id_continue_button = ribbonButtons->findItemNamed("continue");
ribbonButtons->setItemVisible(id_continue_button, saved_gp != NULL);
ribbonButtons->setItemVisible(id_continue_button, continue_visible);
ribbonButtons->setLabel(id_continue_button, _("Continue saved GP"));
}
else