diff --git a/src/states_screens/dialogs/enter_gp_name_dialog.cpp b/src/states_screens/dialogs/enter_gp_name_dialog.cpp index e75c64abc..7d68bf09b 100644 --- a/src/states_screens/dialogs/enter_gp_name_dialog.cpp +++ b/src/states_screens/dialogs/enter_gp_name_dialog.cpp @@ -84,17 +84,13 @@ void EnterGPNameDialog::onEnterPressedInternal() if (name.size() > 0 && name != "Random Grand Prix") { // check for duplicate names - for (unsigned int i = 0; i < grand_prix_manager->getNumberOfGrandPrix(); i++) + if (grand_prix_manager->existsName(name)) { - const GrandPrixData* gp = grand_prix_manager->getGrandPrix(i); - if (gp->getName() == name) - { - LabelWidget* label = getWidget("title"); - assert(label != NULL); - label->setText(_("Another grand prix with this name already exists."), false); - sfx_manager->quickSound("anvil"); - return; - } + LabelWidget* label = getWidget("title"); + assert(label != NULL); + label->setText(_("Another grand prix with this name already exists."), false); + sfx_manager->quickSound("anvil"); + return; } // It's unsafe to delete from inside the event handler so we do it diff --git a/src/states_screens/grand_prix_cutscene.cpp b/src/states_screens/grand_prix_cutscene.cpp index 533ac78d3..b4032adf2 100644 --- a/src/states_screens/grand_prix_cutscene.cpp +++ b/src/states_screens/grand_prix_cutscene.cpp @@ -18,23 +18,47 @@ #include "guiengine/scalable_font.hpp" #include "guiengine/widgets/button_widget.hpp" #include "modes/cutscene_world.hpp" +#include "race/grand_prix_data.hpp" +#include "race/grand_prix_manager.hpp" +#include "race/race_manager.hpp" #include "states_screens/grand_prix_cutscene.hpp" +#include "tracks/track_manager.hpp" + +#include +#include typedef GUIEngine::ButtonWidget Button; -/** A Button to save the GP if it was a random one */ +/** A Button to save the GP if it was a random GP */ void GrandPrixCutscene::saveGPButton() { - #ifdef IMPLEMENTATION_FINISHED if (race_manager->getGrandPrix().getId() != "random") getWidget