Fixed minor in-game menu bug found by KroArtem
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8949 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d391815608
commit
fa464cd4ab
@ -1042,9 +1042,9 @@ bool DynamicRibbonWidget::findItemInRows(const char* name, int* p_row, int* p_id
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool DynamicRibbonWidget::setSelection(int item_id, const int playerID, const bool focusIt)
|
||||
bool DynamicRibbonWidget::setSelection(int item_id, const int playerID, const bool focusIt, bool evenIfDeactivated)
|
||||
{
|
||||
if (m_deactivated) return false;
|
||||
if (m_deactivated && !evenIfDeactivated) return false;
|
||||
|
||||
//printf("****DynamicRibbonWidget::setSelection()****\n");
|
||||
|
||||
@ -1098,16 +1098,16 @@ bool DynamicRibbonWidget::setSelection(int item_id, const int playerID, const bo
|
||||
return true;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
bool DynamicRibbonWidget::setSelection(const std::string item_codename, const int playerID, const bool focusIt)
|
||||
bool DynamicRibbonWidget::setSelection(const std::string item_codename, const int playerID, const bool focusIt, bool evenIfDeactivated)
|
||||
{
|
||||
if (m_deactivated) return false;
|
||||
if (m_deactivated && !evenIfDeactivated) return false;
|
||||
|
||||
const int item_count = m_items.size();
|
||||
for (int n=0; n<item_count; n++)
|
||||
{
|
||||
if (m_items[n].m_code_name == item_codename)
|
||||
{
|
||||
return setSelection(n, playerID, focusIt);
|
||||
return setSelection(n, playerID, focusIt, evenIfDeactivated);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -250,14 +250,14 @@ namespace GUIEngine
|
||||
* \param item_id In range [0 .. number of items added through 'addItem' - 1]
|
||||
* \return Whether setting the selection was successful (whether the item exists)
|
||||
*/
|
||||
bool setSelection(int item_id, const int playerID, const bool focusIt);
|
||||
bool setSelection(int item_id, const int playerID, const bool focusIt, bool evenIfDeactivated=false);
|
||||
|
||||
/**
|
||||
* \brief Select an item from its codename.
|
||||
*
|
||||
* \return Whether setting the selection was successful (whether the item exists)
|
||||
*/
|
||||
bool setSelection(const std::string item_codename, const int playerID, const bool focusIt);
|
||||
bool setSelection(const std::string item_codename, const int playerID, const bool focusIt, bool evenIfDeactivated=false);
|
||||
|
||||
/** \brief Callback from parent class Widget. */
|
||||
virtual void elementRemoved();
|
||||
|
@ -235,7 +235,8 @@ void OptionsScreenVideo::init()
|
||||
char searching_for[32];
|
||||
snprintf(searching_for, 32, "%ix%i", (int)UserConfigParams::m_width, (int)UserConfigParams::m_height);
|
||||
|
||||
if (res->setSelection(searching_for, PLAYER_ID_GAME_MASTER, false))
|
||||
|
||||
if (res->setSelection(searching_for, PLAYER_ID_GAME_MASTER, false /* focus it */, true /* even if deactivated */))
|
||||
{
|
||||
// ok found
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user