Fixed kart spinner being 'empty' the second time (and subsequent)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3969 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-08-30 23:12:00 +00:00
parent d35635f1f6
commit 61b86879f8
4 changed files with 18 additions and 11 deletions

View File

@ -781,7 +781,6 @@ void Skin::drawSpinnerBody(const core::rect< s32 > &rect, Widget* widget, const
}
}
BoxRenderParams& params = (focused || pressed) ? SkinConfig::m_render_params["spinner::focused"] :
SkinConfig::m_render_params["spinner::neutral"];
@ -970,6 +969,10 @@ void Skin::process3DPane(IGUIElement *element, const core::rect< s32 > &rect, co
Widget* widget = GUIEngine::getCurrentScreen()->getWidget(id);
//std::cout << "3D Pane " << id << " : ";
//if(widget == NULL) std::cout << "NULL\n";
//else std::cout << widget->m_properties[PROP_ID].c_str() << std::endl;
if(widget == NULL) return;
const WidgetType type = widget->m_type;

View File

@ -78,6 +78,7 @@ Widget::Widget(bool reserve_id)
m_event_handler = NULL;
m_show_bounding_box = false;
m_parent = NULL;
m_reserve_id = reserve_id;
for (int n=0; n<MAX_PLAYER_COUNT; n++)
{
@ -85,15 +86,18 @@ Widget::Widget(bool reserve_id)
GUIEngine::g_focus_for_player[n] = false;
}
if (reserve_id)
m_reserved_id = -1;
}
// -----------------------------------------------------------------------------
void Widget::add()
{
if (m_reserve_id)
{
m_reserved_id = getNewID();
}
else
{
m_reserved_id = -1;
}
}
// -----------------------------------------------------------------------------
/**
* \param playerID ID of the player you want to set/unset focus for, starting from 0

View File

@ -171,6 +171,8 @@ namespace GUIEngine
which players beyong player 1 have this widget focused. */
bool m_player_focus[MAX_PLAYER_COUNT];
bool m_reserve_id;
public:
/**
* This is set to NULL by default; set to something else in a widget to mean
@ -285,7 +287,7 @@ namespace GUIEngine
* Create and add the irrLicht widget(s) associated with this object.
* Call after Widget was read from XML file and laid out.
*/
virtual void add() {};
virtual void add();
};

View File

@ -94,8 +94,6 @@ namespace KartSelectionScreen
m_irrlicht_widget_ID = irrlichtWidgetID;
this->playerID = playerID;
// FIXME : if a player removes itself, all IDs need to be updated
this->m_properties[PROP_ID] = StringUtils::insertValues("@p%i", playerID);
setSize(area->x, area->y, area->w, area->h);