Merge pull request #1463 from konstin/gp_editor_laps

small improvements to the gp editor
This commit is contained in:
auriamg
2014-08-18 19:04:43 -04:00
3 changed files with 15 additions and 31 deletions

View File

@@ -103,20 +103,17 @@ void EditGPScreen::eventCallback(GUIEngine::Widget* widget, const std::string& n
setModified(true);
}
}
else if (m_action == "add" || m_action == "edit")
else if (m_action == "edit")
{
if (m_action == "edit")
{
edit();
}
else
{
EditTrackScreen* edit = EditTrackScreen::getInstance();
assert(edit != NULL);
//By default, 3 laps and no reversing
edit->setSelection(NULL, 3, false);
StateManager::get()->pushScreen(edit);
}
edit();
}
else if (m_action == "add")
{
EditTrackScreen* edit = EditTrackScreen::getInstance();
assert(edit != NULL);
//By default, 3 laps and no reversing
edit->setSelection(NULL, 3, false);
StateManager::get()->pushScreen(edit);
}
else if (m_action == "remove")
{

View File

@@ -234,7 +234,7 @@ void EditTrackScreen::selectTrack(const std::string& id)
tracks->setSelection("", PLAYER_ID_GAME_MASTER, true);
selected_track->setText(_("Select a track"), true);
laps->setValue(3);
laps->setValue(m_track->getDefaultNumberOfLaps());
reverse->setVisible(true);
reverse->setState(false);

View File

@@ -205,6 +205,9 @@ void GrandPrixEditorScreen::loadGPList()
// Reset GP list everytime (accounts for locking changes, etc.)
gplist_widget->clearItems();
// ensures that no GP and no track is NULL
grand_prix_manager->checkConsistency();
// Build GP list
for (unsigned int i = 0; i < grand_prix_manager->getNumberOfGrandPrix(); i++)
{
@@ -215,23 +218,7 @@ void GrandPrixEditorScreen::loadGPList()
for (unsigned int t=0; t<tracks.size(); t++)
{
Track* track = track_manager->getTrack(tracks[t]);
if (track == NULL)
{
Log::warn("GrandPrixEditor",
"Grand Prix '%s' refers to track '%s', which does not exist\n",
gp->getId().c_str(), tracks[t].c_str());
}
else
{
sshot_files.push_back(track->getScreenshotFile());
}
}
if (sshot_files.size() == 0)
{
Log::warn("GrandPrixEditor",
"Grand Prix '%s' does not contain any valid track\n",
gp->getId().c_str());
sshot_files.push_back("gui/main_help.png");
sshot_files.push_back(track->getScreenshotFile());
}
gplist_widget->addAnimatedItem(translations->fribidize(gp->getName()), gp->getId(),