From 3a8bba6cad10a995f643520ab8edb5fbb7d0d874 Mon Sep 17 00:00:00 2001 From: konstin Date: Sun, 11 May 2014 17:42:50 +0200 Subject: [PATCH] remove unnecessary in tracks_screen.cpp --- src/states_screens/tracks_screen.cpp | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/states_screens/tracks_screen.cpp b/src/states_screens/tracks_screen.cpp index 68a7cf102..b16ba2ad0 100644 --- a/src/states_screens/tracks_screen.cpp +++ b/src/states_screens/tracks_screen.cpp @@ -75,9 +75,6 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, const if (selection == "random_track") { - RibbonWidget* tabs = this->getWidget("trackgroups"); - assert(tabs != NULL); - if (m_random_track_list.empty()) return; std::string track = m_random_track_list.front(); @@ -148,7 +145,6 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, const void TracksScreen::beforeAddingWidget() { Screen::init(); - // Dynamically add tabs RibbonWidget* tabs = this->getWidget("trackgroups"); tabs->clearAllChildren(); @@ -190,6 +186,9 @@ void TracksScreen::init() // Reset GP list everytime (accounts for locking changes, etc.) gps_widget->clearItems(); + // Ensure that no GP and no track is NULL + grand_prix_manager->checkConsistency(); + // Build GP list const int gpAmount = grand_prix_manager->getNumberOfGrandPrix(); for (int n=0; n screenshots; for (unsigned int t=0; tgetTrack(tracks[t]); - if (curr == NULL) - { - std::cerr << "/!\\ WARNING: Grand Prix '" << gp->getId() << "' refers to track '" - << tracks[t] << "', which does not exist.\n"; - } - else - { - screenshots.push_back(curr->getScreenshotFile()); - } + const Track* curr = track_manager->getTrack(tracks[t]); + screenshots.push_back(curr->getScreenshotFile()); } if (screenshots.size() == 0) { @@ -247,7 +238,6 @@ void TracksScreen::init() RibbonWidget* tabs = this->getWidget("trackgroups"); tabs->select(UserConfigParams::m_last_used_track_group, PLAYER_ID_GAME_MASTER); - buildTrackList(); // select old track for the game master (if found) @@ -286,8 +276,8 @@ void TracksScreen::buildTrackList() if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_EASTER_EGG && !curr->hasEasterEggs()) continue; - if (curr->isArena() || curr->isSoccer()) continue; - if (curr->isInternal()) continue; + if (curr->isArena() || curr->isSoccer() || curr->isInternal()) + continue; if(PlayerManager::getCurrentPlayer()->isLocked(curr->getIdent())) { @@ -316,9 +306,8 @@ void TracksScreen::buildTrackList() if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_EASTER_EGG && !curr->hasEasterEggs()) continue; - if (curr->isArena()) continue; - if (curr->isSoccer()) continue; - if (curr->isInternal()) continue; + if (curr->isArena() || curr->isSoccer() || curr->isInternal()) + continue; if (PlayerManager::getCurrentPlayer()->isLocked(curr->getIdent())) {