Unlock all karts in multiplayer mode.
This commit is contained in:
parent
75b24c96ad
commit
c91f9655d8
@ -711,7 +711,7 @@ void KartSelectionScreen::playerConfirm(const int player_id)
|
|||||||
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
|
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
|
||||||
assert(w != NULL);
|
assert(w != NULL);
|
||||||
const std::string selection = w->getSelectionIDString(player_id);
|
const std::string selection = w->getSelectionIDString(player_id);
|
||||||
if (StringUtils::startsWith(selection, ID_LOCKED))
|
if (StringUtils::startsWith(selection, ID_LOCKED) && !m_multiplayer)
|
||||||
{
|
{
|
||||||
unlock_manager->playLockSound();
|
unlock_manager->playLockSound();
|
||||||
return;
|
return;
|
||||||
@ -839,7 +839,7 @@ void KartSelectionScreen::updateKartWidgetModel(uint8_t widget_id,
|
|||||||
->setText( _("Random Kart"), false );
|
->setText( _("Random Kart"), false );
|
||||||
}
|
}
|
||||||
// selection contains the name of the kart, so check only for substr
|
// selection contains the name of the kart, so check only for substr
|
||||||
else if (StringUtils::startsWith(selection, ID_LOCKED))
|
else if (StringUtils::startsWith(selection, ID_LOCKED) && !m_multiplayer)
|
||||||
{
|
{
|
||||||
w3->clearModels();
|
w3->clearModels();
|
||||||
w3->addModel(irr_driver->getAnimatedMesh(
|
w3->addModel(irr_driver->getAnimatedMesh(
|
||||||
@ -1009,13 +1009,13 @@ void KartSelectionScreen::eventCallback(Widget* widget,
|
|||||||
{
|
{
|
||||||
// FIXME: two players may be given the same kart by
|
// FIXME: two players may be given the same kart by
|
||||||
// the use of random
|
// the use of random
|
||||||
const int randomID = random.get( count );
|
const int random_id = random.get( count );
|
||||||
|
|
||||||
// select kart for players > 0 (player 0 is the one
|
// select kart for players > 0 (player 0 is the one
|
||||||
// that can change the groups, so focus for player 0
|
// that can change the groups, so focus for player 0
|
||||||
// must remain on the tabs)
|
// must remain on the tabs)
|
||||||
const bool success =
|
const bool success =
|
||||||
w->setSelection( randomID, n,
|
w->setSelection( random_id, n,
|
||||||
n != PLAYER_ID_GAME_MASTER );
|
n != PLAYER_ID_GAME_MASTER );
|
||||||
if (!success)
|
if (!success)
|
||||||
Log::warn("KartSelectionScreen",
|
Log::warn("KartSelectionScreen",
|
||||||
@ -1155,21 +1155,23 @@ void KartSelectionScreen::allPlayersDone()
|
|||||||
if (selected_kart == RANDOM_KART_ID)
|
if (selected_kart == RANDOM_KART_ID)
|
||||||
{
|
{
|
||||||
// don't select an already selected kart
|
// don't select an already selected kart
|
||||||
int randomID;
|
int random_id;
|
||||||
// to prevent infinite loop in case they are all locked
|
// to prevent infinite loop in case they are all locked
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
randomID = random.get(item_count);
|
random_id = random.get(item_count);
|
||||||
if (items[randomID].m_code_name != ID_DONT_USE &&
|
// valid kart if it can bt used, and is either not locked,
|
||||||
!StringUtils::startsWith(items[randomID].m_code_name,
|
// or it's a multiplayer race.
|
||||||
ID_LOCKED))
|
if (items[random_id].m_code_name != ID_DONT_USE &&
|
||||||
|
(!StringUtils::startsWith(items[random_id].m_code_name, ID_LOCKED)
|
||||||
|
|| m_multiplayer) )
|
||||||
{
|
{
|
||||||
selected_kart = items[randomID].m_code_name;
|
selected_kart = items[random_id].m_code_name;
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
items[randomID].m_code_name = ID_DONT_USE;
|
items[random_id].m_code_name = ID_DONT_USE;
|
||||||
count++;
|
count++;
|
||||||
if (count > 100) return;
|
if (count > 100) return;
|
||||||
}
|
}
|
||||||
@ -1444,7 +1446,8 @@ void KartSelectionScreen::setKartsFromCurrentGroup()
|
|||||||
for(unsigned int i=0; i<karts.size(); i++)
|
for(unsigned int i=0; i<karts.size(); i++)
|
||||||
{
|
{
|
||||||
const KartProperties* prop = karts.get(i);
|
const KartProperties* prop = karts.get(i);
|
||||||
if (PlayerManager::getCurrentPlayer()->isLocked(prop->getIdent()))
|
if (PlayerManager::getCurrentPlayer()->isLocked(prop->getIdent()) &&
|
||||||
|
!m_multiplayer)
|
||||||
{
|
{
|
||||||
w->addItem(_("Locked : solve active challenges to gain access to more!"),
|
w->addItem(_("Locked : solve active challenges to gain access to more!"),
|
||||||
ID_LOCKED + prop->getIdent(),
|
ID_LOCKED + prop->getIdent(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user