Don't let players switch identity in single player mode. In single player mode this should be changed in the options screen
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11950 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
04c3b93bb1
commit
7921acc4aa
@ -1136,6 +1136,8 @@ void Skin::drawRibbonChild(const core::recti &rect, Widget* widget,
|
||||
void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
|
||||
const bool pressed, bool focused)
|
||||
{
|
||||
if (!widget->isVisible()) return;
|
||||
|
||||
if (!focused)
|
||||
{
|
||||
IGUIElement* focused_widget = NULL;
|
||||
@ -1268,6 +1270,8 @@ void Skin::drawSpinnerBody(const core::recti &rect, Widget* widget,
|
||||
void Skin::drawSpinnerChild(const core::recti &rect, Widget* widget,
|
||||
const bool pressed, bool focused)
|
||||
{
|
||||
if (!widget->isVisible()) return;
|
||||
|
||||
if (pressed)
|
||||
{
|
||||
Widget* spinner = widget->m_event_handler;
|
||||
|
@ -247,6 +247,8 @@ public:
|
||||
ModelViewWidget* m_model_view;
|
||||
LabelWidget* m_kart_name;
|
||||
|
||||
KartSelectionScreen* m_parent_screen;
|
||||
|
||||
gui::IGUIStaticText* m_ready_text;
|
||||
|
||||
//LabelWidget *getPlayerIDLabel() {return m_player_ID_label;}
|
||||
@ -264,6 +266,7 @@ public:
|
||||
m_magic_number = 0x33445566;
|
||||
#endif
|
||||
m_ready_text = NULL;
|
||||
m_parent_screen = parent;
|
||||
|
||||
m_associatedPlayer = associatedPlayer;
|
||||
x_speed = 1.0f;
|
||||
@ -310,12 +313,20 @@ public:
|
||||
|
||||
spinnerID = StringUtils::insertValues("@p%i_spinner", m_playerID);
|
||||
|
||||
const int playerAmount = UserConfigParams::m_all_players.size();
|
||||
m_player_ident_spinner->m_properties[PROP_MIN_VALUE] = "0";
|
||||
m_player_ident_spinner->m_properties[PROP_MAX_VALUE] =
|
||||
StringUtils::toString(playerAmount-1);
|
||||
m_player_ident_spinner->m_properties[PROP_ID] = spinnerID;
|
||||
m_player_ident_spinner->m_properties[PROP_WRAP_AROUND] = "true";
|
||||
if (parent->m_multiplayer)
|
||||
{
|
||||
const int playerAmount = UserConfigParams::m_all_players.size();
|
||||
m_player_ident_spinner->m_properties[PROP_MIN_VALUE] = "0";
|
||||
m_player_ident_spinner->m_properties[PROP_MAX_VALUE] =
|
||||
StringUtils::toString(playerAmount-1);
|
||||
m_player_ident_spinner->m_properties[PROP_WRAP_AROUND] = "true";
|
||||
}
|
||||
else
|
||||
{
|
||||
m_player_ident_spinner->m_properties[PROP_MIN_VALUE] = "0";
|
||||
m_player_ident_spinner->m_properties[PROP_MAX_VALUE] = "0";
|
||||
}
|
||||
|
||||
//m_player_ident_spinner->m_event_handler = this;
|
||||
m_children.push_back(m_player_ident_spinner);
|
||||
@ -509,16 +520,24 @@ public:
|
||||
m_model_view->update(0);
|
||||
|
||||
m_player_ident_spinner->clearLabels();
|
||||
const int playerAmount = UserConfigParams::m_all_players.size();
|
||||
for (int n=0; n<playerAmount; n++)
|
||||
if (m_parent_screen->m_multiplayer)
|
||||
{
|
||||
core::stringw name = UserConfigParams::m_all_players[n].getName();
|
||||
m_player_ident_spinner->addLabel( translations->fribidize(name) );
|
||||
}
|
||||
const int playerAmount = UserConfigParams::m_all_players.size();
|
||||
for (int n=0; n<playerAmount; n++)
|
||||
{
|
||||
core::stringw name = UserConfigParams::m_all_players[n].getName();
|
||||
m_player_ident_spinner->addLabel( translations->fribidize(name) );
|
||||
}
|
||||
|
||||
// select the right player profile in the spinner
|
||||
m_player_ident_spinner->setValue(m_associatedPlayer->getProfile()
|
||||
->getName() );
|
||||
// select the right player profile in the spinner
|
||||
m_player_ident_spinner->setValue(m_associatedPlayer->getProfile()
|
||||
->getName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_player_ident_spinner->addLabel( m_associatedPlayer->getProfile()->getName() );
|
||||
m_player_ident_spinner->setVisible(false);
|
||||
}
|
||||
|
||||
assert(m_player_ident_spinner->getStringValue() ==
|
||||
m_associatedPlayer->getProfile()->getName());
|
||||
@ -720,9 +739,13 @@ public:
|
||||
.c_str()).c_str()
|
||||
<< std::endl;
|
||||
}
|
||||
m_associatedPlayer->setPlayerProfile(
|
||||
UserConfigParams::m_all_players.get(m_player_ident_spinner
|
||||
->getValue()) );
|
||||
|
||||
if (m_parent_screen->m_multiplayer)
|
||||
{
|
||||
m_associatedPlayer->setPlayerProfile(
|
||||
UserConfigParams::m_all_players.get(m_player_ident_spinner
|
||||
->getValue()) );
|
||||
}
|
||||
}
|
||||
|
||||
return EVENT_LET; // continue propagating the event
|
||||
@ -1810,9 +1833,12 @@ bool KartSelectionScreen::validateIdentChoices()
|
||||
m_kart_widgets[n].m_player_ident_spinner->markAsCorrect();
|
||||
|
||||
// verify internal consistency in debug mode
|
||||
assert( m_kart_widgets[n].getAssociatedPlayer()->getProfile() ==
|
||||
UserConfigParams::m_all_players.get(m_kart_widgets[n]
|
||||
.m_player_ident_spinner->getValue()) );
|
||||
if (m_multiplayer)
|
||||
{
|
||||
assert( m_kart_widgets[n].getAssociatedPlayer()->getProfile() ==
|
||||
UserConfigParams::m_all_players.get(m_kart_widgets[n]
|
||||
.m_player_ident_spinner->getValue()) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user