In kart screen, display user name and not internal name

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3950 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-08-29 17:28:33 +00:00
parent 1281cc5cfd
commit 0db37d90fb
3 changed files with 16 additions and 10 deletions

View File

@ -336,7 +336,8 @@ bool DynamicRibbonWidget::rightPressed(const int playerID)
const int listenerAmount = m_hover_listeners.size();
for (int n=0; n<listenerAmount; n++)
{
m_hover_listeners[n].onSelectionChanged(this, getSelectedRibbon(playerID)->getSelectionIDString(playerID), playerID);
m_hover_listeners[n].onSelectionChanged(this, getSelectedRibbon(playerID)->getSelectionIDString(playerID),
getSelectedRibbon(playerID)->getSelectionText(playerID), playerID);
}
}
@ -356,7 +357,8 @@ bool DynamicRibbonWidget::leftPressed(const int playerID)
const int listenerAmount = m_hover_listeners.size();
for (int n=0; n<listenerAmount; n++)
{
m_hover_listeners[n].onSelectionChanged(this, w->getSelectionIDString(playerID), playerID);
m_hover_listeners[n].onSelectionChanged(this, w->getSelectionIDString(playerID),
w->getSelectionText(playerID), playerID);
}
}
@ -406,7 +408,8 @@ bool DynamicRibbonWidget::mouseHovered(Widget* child)
const int listenerAmount = m_hover_listeners.size();
for (int n=0; n<listenerAmount; n++)
{
m_hover_listeners[n].onSelectionChanged(this, getSelectedRibbon(playerID)->getSelectionIDString(playerID), playerID);
m_hover_listeners[n].onSelectionChanged(this, getSelectedRibbon(playerID)->getSelectionIDString(playerID),
getSelectedRibbon(playerID)->getSelectionText(playerID), playerID);
}
}
@ -421,7 +424,8 @@ void DynamicRibbonWidget::focused(const int playerID)
const int listenerAmount = m_hover_listeners.size();
for(int n=0; n<listenerAmount; n++)
{
m_hover_listeners[n].onSelectionChanged(this, getSelectedRibbon(playerID)->getSelectionIDString(playerID), playerID);
m_hover_listeners[n].onSelectionChanged(this, getSelectedRibbon(playerID)->getSelectionIDString(playerID),
getSelectedRibbon(playerID)->getSelectionText(playerID), playerID);
}
}
// -----------------------------------------------------------------------------
@ -432,7 +436,8 @@ void DynamicRibbonWidget::onRowChange(RibbonWidget* row, const int playerID)
const int listenerAmount = m_hover_listeners.size();
for (int n=0; n<listenerAmount; n++)
{
m_hover_listeners[n].onSelectionChanged(this, row->getSelectionIDString(playerID), playerID);
m_hover_listeners[n].onSelectionChanged(this, row->getSelectionIDString(playerID),
row->getSelectionText(playerID), playerID);
}
}

View File

@ -39,7 +39,8 @@ namespace GUIEngine
{
public:
virtual ~DynamicRibbonHoverListener() {}
virtual void onSelectionChanged(DynamicRibbonWidget* theWidget, const std::string& selectionID, const int playerID) = 0;
virtual void onSelectionChanged(DynamicRibbonWidget* theWidget, const std::string& selectionID,
const std::string& selectionText, const int playerID) = 0;
};
/** The description of an item added to a DynamicRibbonWidget */

View File

@ -409,7 +409,8 @@ namespace KartSelectionScreen
class KartHoverListener : public DynamicRibbonHoverListener
{
public:
void onSelectionChanged(DynamicRibbonWidget* theWidget, const std::string& selectionID, const int playerID)
void onSelectionChanged(DynamicRibbonWidget* theWidget, const std::string& selectionID,
const std::string& selectionText, const int playerID)
{
ModelViewWidget* w3 = g_player_karts[playerID].modelView;
assert( w3 != NULL );
@ -436,9 +437,8 @@ class KartHoverListener : public DynamicRibbonHoverListener
w3->addModel( kartModel->getWheelModel(2), kartModel->getWheelGraphicsPosition(2) );
w3->addModel( kartModel->getWheelModel(3), kartModel->getWheelGraphicsPosition(3) );
w3->update(0);
// FIXME: don't display the internal name!
g_player_karts[playerID].kartName->setText( selectionID.c_str() );
g_player_karts[playerID].kartName->setText( selectionText.c_str() );
}
g_player_karts[playerID].setKartInternalName(selectionID);