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;
}
if (PlayerManager::getCurrentPlayer()->isLocked("difficulty_best"))
{
RibbonWidget* w = getWidget<RibbonWidget>("difficulty");
assert(w != NULL);
int index = w->findItemNamed("best");
Widget* hardestWidget = &w->getChildren()[index];
if (PlayerManager::getCurrentPlayer()->isLocked("difficulty_best"))
{
hardestWidget->setBadge(LOCKED_BADGE);
hardestWidget->setActive(false);
}
else
{
hardestWidget->unsetBadge(LOCKED_BADGE);
hardestWidget->setActive(true);
}
}
} // init
// -----------------------------------------------------------------------------