From 2d9e38f7f6a2ca57b1a3637fdcd1925df2b740f6 Mon Sep 17 00:00:00 2001 From: Deve Date: Wed, 7 Jan 2015 21:15:53 +0100 Subject: [PATCH] Display continue button only if next track isn't first available in GP. Fixed a crash. --- src/race/race_manager.cpp | 4 ++-- src/states_screens/gp_info_screen.cpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/race/race_manager.cpp b/src/race/race_manager.cpp index 61e0b2b03..acfc0d021 100644 --- a/src/race/race_manager.cpp +++ b/src/race/race_manager.cpp @@ -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); diff --git a/src/states_screens/gp_info_screen.cpp b/src/states_screens/gp_info_screen.cpp index 4da2b6587..a66dc3717 100644 --- a/src/states_screens/gp_info_screen.cpp +++ b/src/states_screens/gp_info_screen.cpp @@ -135,10 +135,12 @@ void GPInfoScreen::beforeAddingWidget() StateManager::get()->getActivePlayerProfile(0)->getUniqueID(), m_gp.getId(), race_manager->getNumLocalPlayers()); + + bool continue_visible = saved_gp && saved_gp->getNextTrack() > 0; RibbonWidget* ribbonButtons = getWidget("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