making sure tartet spinners are invisible when not needed; small adjustments
This commit is contained in:
parent
b8132ba14d
commit
2e3713840f
@ -138,12 +138,51 @@ void TrackInfoScreen::init()
|
||||
if (image != NULL)
|
||||
screenshot->setImage(image);
|
||||
|
||||
m_target_type_spinner->setVisible(false);
|
||||
m_target_type_label->setVisible(false);
|
||||
m_target_value_spinner->setVisible(false);
|
||||
m_target_value_label->setVisible(false);
|
||||
|
||||
// Soccer options
|
||||
// -------------
|
||||
const bool is_soccer = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER;
|
||||
if (is_soccer)
|
||||
{
|
||||
m_target_type_spinner->setVisible(true);
|
||||
m_target_type_label->setVisible(true);
|
||||
m_target_value_spinner->setVisible(true);
|
||||
m_target_value_label->setVisible(true);
|
||||
|
||||
if (UserConfigParams::m_num_goals <= 0)
|
||||
UserConfigParams::m_num_goals = UserConfigParams::m_num_goals.getDefaultValue();
|
||||
|
||||
if (UserConfigParams::m_soccer_time_limit <= 0)
|
||||
UserConfigParams::m_soccer_time_limit = UserConfigParams::m_soccer_time_limit.getDefaultValue();
|
||||
|
||||
m_target_type_spinner->clearLabels();
|
||||
m_target_type_spinner->addLabel(_("Time limit"));
|
||||
m_target_type_spinner->addLabel(_("Goals limit"));
|
||||
m_target_type_spinner->setValue(UserConfigParams::m_soccer_use_time_limit ? 0 : 1);
|
||||
|
||||
if (UserConfigParams::m_soccer_use_time_limit)
|
||||
{
|
||||
m_target_value_label->setText(_("Maximum time (min.)"), false);
|
||||
m_target_value_spinner->setValue(UserConfigParams::m_soccer_time_limit);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_target_value_label->setText(_("Number of goals to win"), false);
|
||||
m_target_value_spinner->setValue(UserConfigParams::m_num_goals);
|
||||
}
|
||||
}
|
||||
|
||||
// Lap count m_lap_spinner
|
||||
// -----------------------
|
||||
m_target_value_spinner->setVisible(has_laps);
|
||||
m_target_value_label->setVisible(has_laps);
|
||||
if (has_laps)
|
||||
{
|
||||
m_target_value_spinner->setVisible(true);
|
||||
m_target_value_label->setVisible(true);
|
||||
|
||||
if (UserConfigParams::m_artist_debug_mode)
|
||||
m_target_value_spinner->setMin(0);
|
||||
else
|
||||
@ -259,37 +298,6 @@ void TrackInfoScreen::init()
|
||||
m_record_race->setState(false);
|
||||
}
|
||||
|
||||
bool is_soccer = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER;
|
||||
m_target_type_spinner->setVisible(is_soccer);
|
||||
m_target_type_label->setVisible(is_soccer);
|
||||
if (is_soccer)
|
||||
{
|
||||
if (UserConfigParams::m_num_goals <= 0)
|
||||
UserConfigParams::m_num_goals = UserConfigParams::m_num_goals.getDefaultValue();
|
||||
|
||||
if (UserConfigParams::m_soccer_time_limit <= 0)
|
||||
UserConfigParams::m_soccer_time_limit = UserConfigParams::m_soccer_time_limit.getDefaultValue();
|
||||
|
||||
m_target_type_spinner->clearLabels();
|
||||
m_target_type_spinner->addLabel(_("Time limit"));
|
||||
m_target_type_spinner->addLabel(_("Goals limit"));
|
||||
m_target_type_spinner->setValue(UserConfigParams::m_soccer_use_time_limit ? 0 : 1);
|
||||
|
||||
m_target_value_spinner->setVisible(true);
|
||||
m_target_value_label->setVisible(true);
|
||||
|
||||
if (UserConfigParams::m_soccer_use_time_limit)
|
||||
{
|
||||
m_target_value_label->setText(_("Maximum time (min.)"), false);
|
||||
m_target_value_spinner->setValue(UserConfigParams::m_soccer_time_limit);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_target_value_label->setText(_("Number of goals to win"), false);
|
||||
m_target_value_spinner->setValue(UserConfigParams::m_num_goals);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- High Scores
|
||||
m_highscore_label->setVisible(has_highscores);
|
||||
|
||||
@ -449,7 +457,7 @@ void TrackInfoScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
}
|
||||
else if (name == "target-type-spinner")
|
||||
{
|
||||
bool timed = m_target_type_spinner->getValue() == 0;
|
||||
const bool timed = m_target_type_spinner->getValue() == 0;
|
||||
UserConfigParams::m_soccer_use_time_limit = timed;
|
||||
|
||||
if (timed)
|
||||
@ -466,19 +474,15 @@ void TrackInfoScreen::eventCallback(Widget* widget, const std::string& name,
|
||||
}
|
||||
else if (name == "target-value-spinner")
|
||||
{
|
||||
bool is_soccer = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER;
|
||||
const bool is_soccer = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER;
|
||||
if (is_soccer)
|
||||
{
|
||||
bool timed = m_target_type_spinner->getValue() == 0;
|
||||
const bool timed = m_target_type_spinner->getValue() == 0;
|
||||
if (timed)
|
||||
{
|
||||
UserConfigParams::m_soccer_time_limit = m_target_value_spinner->getValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
UserConfigParams::m_num_goals = m_target_value_spinner->getValue();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(race_manager->modeHasLaps());
|
||||
|
@ -55,10 +55,10 @@ class TrackInfoScreen : public GUIEngine::Screen,
|
||||
/** The label besides the target types spinner. */
|
||||
GUIEngine::LabelWidget* m_target_type_label;
|
||||
|
||||
/** Spinner for number of laps. */
|
||||
/** Spinner for target value e.g. number of laps or goals to score. */
|
||||
GUIEngine::SpinnerWidget* m_target_value_spinner;
|
||||
|
||||
/** The label besides the lap spinner. */
|
||||
/** The label besides the target value spinner. */
|
||||
GUIEngine::LabelWidget* m_target_value_label;
|
||||
|
||||
/** Spinner for number of AI karts. */
|
||||
|
Loading…
Reference in New Issue
Block a user