From 42c7a0c2d7f75892a9e08dab03aac071b6b6de64 Mon Sep 17 00:00:00 2001 From: auria Date: Sat, 20 Feb 2010 23:30:45 +0000 Subject: [PATCH] Don't allow playing broken GPs git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4779 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/states_screens/dialogs/gp_info_dialog.cpp | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/states_screens/dialogs/gp_info_dialog.cpp b/src/states_screens/dialogs/gp_info_dialog.cpp index 7c561a457..03faaf6c6 100644 --- a/src/states_screens/dialogs/gp_info_dialog.cpp +++ b/src/states_screens/dialogs/gp_info_dialog.cpp @@ -75,6 +75,8 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa const int textHeight = GUIEngine::getFontHeight(); if (height_of_one_line > (int)(textHeight*1.5f)) height_of_one_line = (int)(textHeight*1.5f); + bool gp_ok = true; + for (int t=0; tm_properties[PROP_ID] = "start"; - okBtn->m_text = _("Start Grand Prix"); + + if (gp_ok) + { + okBtn->m_properties[PROP_ID] = "start"; + okBtn->m_text = _("Start Grand Prix"); + } + else + { + okBtn->m_properties[PROP_ID] = "cannot_start"; + okBtn->m_text = _("This Grand Prix is broken!"); + okBtn->m_badges |= BAD_BADGE; + } + okBtn->x = m_area.getWidth()/2 - 200; okBtn->y = y2; okBtn->w = 400; @@ -203,11 +216,15 @@ void GPInfoDialog::onEnterPressedInternal() GUIEngine::EventPropagation GPInfoDialog::processEvent(std::string& eventSource) { - if (eventSource == "start" ) + if (eventSource == "start") { startGPGame(grand_prix_manager->getGrandPrix(m_gp_ident)); return GUIEngine::EVENT_BLOCK; } + else if (eventSource == "cannot_start") + { + sfx_manager->quickSound( "use_anvil" ); + } return GUIEngine::EVENT_LET; }