diff --git a/src/race/grand_prix_data.cpp b/src/race/grand_prix_data.cpp index 35e22a2f7..e1c293a8d 100644 --- a/src/race/grand_prix_data.cpp +++ b/src/race/grand_prix_data.cpp @@ -365,7 +365,7 @@ void GrandPrixData::addTrack(Track* track, unsigned int laps, bool reverse, int n = getNumberOfTracks(true); assert (track != NULL); assert (laps > 0); - assert (-1 < position && position < n); + assert (-1 <= position && position < n); if (position < 0 || position == (n - 1) || m_tracks.empty()) { diff --git a/src/states_screens/dialogs/gp_info_dialog.cpp b/src/states_screens/dialogs/gp_info_dialog.cpp index 840110c57..5472953a1 100644 --- a/src/states_screens/dialogs/gp_info_dialog.cpp +++ b/src/states_screens/dialogs/gp_info_dialog.cpp @@ -44,9 +44,10 @@ using namespace irr::video; using namespace irr::core; using namespace GUIEngine; -// ------------------------------------------------------------------------------------------------------ +// ---------------------------------------------------------------------------- -GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const float h) : ModalDialog(w, h) +GPInfoDialog::GPInfoDialog(const std::string& gp_ident) : + ModalDialog(PERCENT_WIDTH, PERCENT_HEIGHT) { doInit(); m_curr_time = 0.0f; @@ -54,9 +55,9 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa const int y1 = m_area.getHeight()/7; const int y2 = m_area.getHeight()*6/7; - m_gp_ident = gpIdent; + m_gp_ident = gp_ident; - const GrandPrixData* gp = grand_prix_manager->getGrandPrix(gpIdent); + const GrandPrixData* gp = grand_prix_manager->getGrandPrix(gp_ident); assert (gp != NULL); // ---- GP Name @@ -117,7 +118,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa Track* track = (tracks.size() == 0 ? NULL : track_manager->getTrack(tracks[0])); - m_screenshot_widget->m_properties[PROP_ICON] = (track != NULL ? + m_screenshot_widget->m_properties[PROP_ICON] = (track != NULL ? track->getScreenshotFile().c_str() : file_manager->getAsset(FileManager::GUI,"main_help.png")); m_screenshot_widget->setParent(m_irrlicht_window); @@ -132,7 +133,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa SavedGrandPrix* saved_gp = SavedGrandPrix::getSavedGP( StateManager::get() ->getActivePlayerProfile(0) ->getUniqueID(), - gpIdent, + gp_ident, race_manager->getDifficulty(), race_manager->getNumberOfKarts(), race_manager->getNumLocalPlayers()); @@ -188,7 +189,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa okBtn->setFocusForPlayer( PLAYER_ID_GAME_MASTER ); } -// ------------------------------------------------------------------------------------------------------ +// ---------------------------------------------------------------------------- GPInfoDialog::~GPInfoDialog() { @@ -202,7 +203,7 @@ GPInfoDialog::~GPInfoDialog() } -// ------------------------------------------------------------------------------------------------------ +// ---------------------------------------------------------------------------- void GPInfoDialog::onEnterPressedInternal() { @@ -214,7 +215,7 @@ void GPInfoDialog::onEnterPressedInternal() race_manager->startGP(grand_prix_manager->getGrandPrix(gp_id), false, false); } -// ------------------------------------------------------------------------------------------------------ +// ---------------------------------------------------------------------------- GUIEngine::EventPropagation GPInfoDialog::processEvent(const std::string& eventSource) { @@ -242,7 +243,7 @@ GUIEngine::EventPropagation GPInfoDialog::processEvent(const std::string& eventS return GUIEngine::EVENT_LET; } -// ------------------------------------------------------------------------------------------------------ +// ---------------------------------------------------------------------------- void GPInfoDialog::onUpdate(float dt) { @@ -268,4 +269,4 @@ void GPInfoDialog::onUpdate(float dt) m_screenshot_widget->setImage(fn.c_str(), IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE); } -// ------------------------------------------------------------------------------------------------------ +// ---------------------------------------------------------------------------- diff --git a/src/states_screens/dialogs/gp_info_dialog.hpp b/src/states_screens/dialogs/gp_info_dialog.hpp index a6218644c..cc308a742 100644 --- a/src/states_screens/dialogs/gp_info_dialog.hpp +++ b/src/states_screens/dialogs/gp_info_dialog.hpp @@ -38,12 +38,13 @@ private: float m_curr_time; public: + static const float PERCENT_WIDTH = 0.8f; + static const float PERCENT_HEIGHT = 0.7f; /** * Creates a modal dialog with given percentage of screen width and height * atm only used in track_screen.cpp */ - GPInfoDialog(const std::string& gpIdent, const float percentWidth, - const float percentHeight); + GPInfoDialog(const std::string& gpIdent); virtual ~GPInfoDialog(); void onEnterPressedInternal(); diff --git a/src/states_screens/tracks_screen.cpp b/src/states_screens/tracks_screen.cpp index 10dae69c3..a335ab71e 100644 --- a/src/states_screens/tracks_screen.cpp +++ b/src/states_screens/tracks_screen.cpp @@ -115,7 +115,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, if (selection == "locked") unlock_manager->playLockSound(); else - new GPInfoDialog(selection, 0.8f, 0.7f); + new GPInfoDialog(selection); } else if (name == "trackgroups") {