Merge pull request #2317 from MiroslavR/fix-supertux-btn

Fix SuperTux difficulty button state not updating correctly
This commit is contained in:
auriamg 2015-09-18 18:53:07 -04:00
commit 5d9805b8ab

View File

@ -281,16 +281,24 @@ void RaceSetupScreen::init()
break; break;
} }
if (PlayerManager::getCurrentPlayer()->isLocked("difficulty_best"))
{ {
RibbonWidget* w = getWidget<RibbonWidget>("difficulty"); RibbonWidget* w = getWidget<RibbonWidget>("difficulty");
assert(w != NULL); assert(w != NULL);
int index = w->findItemNamed("best"); int index = w->findItemNamed("best");
Widget* hardestWidget = &w->getChildren()[index]; Widget* hardestWidget = &w->getChildren()[index];
if (PlayerManager::getCurrentPlayer()->isLocked("difficulty_best"))
{
hardestWidget->setBadge(LOCKED_BADGE); hardestWidget->setBadge(LOCKED_BADGE);
hardestWidget->setActive(false); hardestWidget->setActive(false);
} }
else
{
hardestWidget->unsetBadge(LOCKED_BADGE);
hardestWidget->setActive(true);
}
}
} // init } // init
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------