Don't show 'random kart' button when no karts are available in the current group, or if there is only one kart
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5570 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d336617eaf
commit
3f0e2b8d74
@ -1458,6 +1458,8 @@ void KartSelectionScreen::setKartsFromCurrentGroup()
|
|||||||
|
|
||||||
// FIXME: merge this code with the code that adds karts initially, copy-and-paste is ugly
|
// FIXME: merge this code with the code that adds karts initially, copy-and-paste is ugly
|
||||||
|
|
||||||
|
int usableKartCount = 0;
|
||||||
|
|
||||||
if (selected_kart_group == ALL_KART_GROUPS_ID)
|
if (selected_kart_group == ALL_KART_GROUPS_ID)
|
||||||
{
|
{
|
||||||
const int kart_amount = kart_properties_manager->getNumberOfKarts();
|
const int kart_amount = kart_properties_manager->getNumberOfKarts();
|
||||||
@ -1475,6 +1477,7 @@ void KartSelectionScreen::setKartsFromCurrentGroup()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
w->addItem(prop->getName().c_str(), prop->getIdent().c_str(), icon_path.c_str());
|
w->addItem(prop->getName().c_str(), prop->getIdent().c_str(), icon_path.c_str());
|
||||||
|
usableKartCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1502,11 +1505,16 @@ void KartSelectionScreen::setKartsFromCurrentGroup()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
w->addItem(prop->getName().c_str(), prop->getIdent().c_str(), icon_path.c_str());
|
w->addItem(prop->getName().c_str(), prop->getIdent().c_str(), icon_path.c_str());
|
||||||
|
usableKartCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add random
|
// add random
|
||||||
w->addItem(_("Random Kart"), RANDOM_KART_ID, "/gui/random_kart.png");
|
if (usableKartCount > 1)
|
||||||
|
{
|
||||||
|
w->addItem(_("Random Kart"), RANDOM_KART_ID, "/gui/random_kart.png");
|
||||||
|
}
|
||||||
|
|
||||||
w->updateItemDisplay();
|
w->updateItemDisplay();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user