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
This commit is contained in:
parent
fa9a038f0a
commit
93f23e8c32
@ -249,7 +249,7 @@ FocusDispatcher* g_dispatcher = NULL;
|
|||||||
playerName->y = player_name_y;
|
playerName->y = player_name_y;
|
||||||
playerName->w = player_name_w;
|
playerName->w = player_name_w;
|
||||||
playerName->h = player_name_h;
|
playerName->h = player_name_h;
|
||||||
playerName->m_event_handler = this;
|
//playerName->m_event_handler = this;
|
||||||
|
|
||||||
if (irrlichtWidgetID == -1)
|
if (irrlichtWidgetID == -1)
|
||||||
{
|
{
|
||||||
@ -412,6 +412,8 @@ FocusDispatcher* g_dispatcher = NULL;
|
|||||||
/** Call when player confirmed his identity and kart */
|
/** Call when player confirmed his identity and kart */
|
||||||
void markAsReady()
|
void markAsReady()
|
||||||
{
|
{
|
||||||
|
if (m_ready) return; // already ready
|
||||||
|
|
||||||
m_ready = true;
|
m_ready = true;
|
||||||
|
|
||||||
stringw playerNameString = playerName->getStringValue();
|
stringw playerNameString = playerName->getStringValue();
|
||||||
@ -524,10 +526,12 @@ FocusDispatcher* g_dispatcher = NULL;
|
|||||||
/** Event callback */
|
/** Event callback */
|
||||||
virtual GUIEngine::EventPropagation transmitEvent(Widget* w, const std::string& originator, const int m_playerID)
|
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::string name = w->m_properties[PROP_ID];
|
||||||
|
|
||||||
|
//std::cout << " (checking if that's me: I am " << spinnerID << ")\n";
|
||||||
|
|
||||||
// update player profile when spinner changed
|
// update player profile when spinner changed
|
||||||
if (originator == spinnerID)
|
if (originator == spinnerID)
|
||||||
{
|
{
|
||||||
@ -987,6 +991,10 @@ bool KartSelectionScreen::validateIdentChoices()
|
|||||||
for (int n=0; n<amount; n++)
|
for (int n=0; n<amount; n++)
|
||||||
{
|
{
|
||||||
m_kart_widgets[n].playerName->markAsCorrect();
|
m_kart_widgets[n].playerName->markAsCorrect();
|
||||||
|
|
||||||
|
// 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; n<amount; n++)
|
for (int n=0; n<amount; n++)
|
||||||
@ -997,7 +1005,9 @@ bool KartSelectionScreen::validateIdentChoices()
|
|||||||
if (m_kart_widgets[n].getAssociatedPlayer()->getProfile() == m_kart_widgets[m].getAssociatedPlayer()->getProfile())
|
if (m_kart_widgets[n].getAssociatedPlayer()->getProfile() == m_kart_widgets[m].getAssociatedPlayer()->getProfile())
|
||||||
{
|
{
|
||||||
printf("\n***\n*** Someone else can't select this identity, you just took it!! ***\n***\n\n");
|
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
|
// two players took the same name. check if one is ready
|
||||||
if (!m_kart_widgets[n].isReady() && m_kart_widgets[m].isReady())
|
if (!m_kart_widgets[n].isReady() && m_kart_widgets[m].isReady())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user