From 93f23e8c32509e946296f58eb9cebcbaf9c83f81 Mon Sep 17 00:00:00 2001 From: auria Date: Mon, 2 Nov 2009 01:30:49 +0000 Subject: [PATCH] Fixed crash when validating choice twice for same player, fixed bug about undetected mouse clicks on player identity spinner git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4195 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/states_screens/kart_selection.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/states_screens/kart_selection.cpp b/src/states_screens/kart_selection.cpp index 62cfaf37b..35d00e3ed 100644 --- a/src/states_screens/kart_selection.cpp +++ b/src/states_screens/kart_selection.cpp @@ -249,7 +249,7 @@ FocusDispatcher* g_dispatcher = NULL; playerName->y = player_name_y; playerName->w = player_name_w; playerName->h = player_name_h; - playerName->m_event_handler = this; + //playerName->m_event_handler = this; if (irrlichtWidgetID == -1) { @@ -412,6 +412,8 @@ FocusDispatcher* g_dispatcher = NULL; /** Call when player confirmed his identity and kart */ void markAsReady() { + if (m_ready) return; // already ready + m_ready = true; stringw playerNameString = playerName->getStringValue(); @@ -524,10 +526,12 @@ FocusDispatcher* g_dispatcher = NULL; /** Event callback */ virtual GUIEngine::EventPropagation transmitEvent(Widget* w, const std::string& originator, const int m_playerID) { - //std::cout << "= kart selection :: transmitEvent " << originator << "=\n"; + //std::cout << "= kart selection :: transmitEvent " << originator << " =\n"; std::string name = w->m_properties[PROP_ID]; + //std::cout << " (checking if that's me: I am " << spinnerID << ")\n"; + // update player profile when spinner changed if (originator == spinnerID) { @@ -987,6 +991,10 @@ bool KartSelectionScreen::validateIdentChoices() for (int n=0; nmarkAsCorrect(); + + // verify internal consistency in debug mode + assert( m_kart_widgets[n].getAssociatedPlayer()->getProfile() == + UserConfigParams::m_all_players.get(m_kart_widgets[n].playerName->getValue()) ); } for (int n=0; ngetProfile() == m_kart_widgets[m].getAssociatedPlayer()->getProfile()) { printf("\n***\n*** Someone else can't select this identity, you just took it!! ***\n***\n\n"); - + std::cout << " Player " << n << " chose " << m_kart_widgets[n].getAssociatedPlayer()->getProfile()->getName() << std::endl; + std::cout << " Player " << m << " chose " << m_kart_widgets[m].getAssociatedPlayer()->getProfile()->getName() << std::endl; + // two players took the same name. check if one is ready if (!m_kart_widgets[n].isReady() && m_kart_widgets[m].isReady()) {