Now player can choose if he want to start new GP or continue previously saved.

Also change string to "Continue" to avoid problems with translations.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14419 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
deveee 2013-11-13 19:32:11 +00:00
parent 8cfb3d5d9c
commit 2127284e94
3 changed files with 44 additions and 11 deletions

View File

@ -337,7 +337,7 @@ void RaceManager::startNew(bool from_overworld)
}
m_track_number = 0;
if(m_major_mode==MAJOR_MODE_GRAND_PRIX)
if(m_major_mode==MAJOR_MODE_GRAND_PRIX && m_continue_saved_gp)
{
//We look if Player 1 has a saved version of this GP.
// =================================================
@ -746,7 +746,8 @@ void RaceManager::rerunRace()
//-----------------------------------------------------------------------------
void RaceManager::startGP(const GrandPrixData* gp, bool from_overworld)
void RaceManager::startGP(const GrandPrixData* gp, bool from_overworld,
bool continue_saved_gp)
{
assert(gp != NULL);
@ -754,6 +755,7 @@ void RaceManager::startGP(const GrandPrixData* gp, bool from_overworld)
setGrandPrix(*gp);
setCoinTarget( 0 ); // Might still be set from a previous challenge
network_manager->setupPlayerKartInfo();
m_continue_saved_gp = continue_saved_gp;
setMajorMode(RaceManager::MAJOR_MODE_GRAND_PRIX);
startNew(from_overworld);

View File

@ -344,6 +344,9 @@ private:
bool m_have_kart_last_position_on_overworld;
Vec3 m_kart_last_position_on_overworld;
/** Determines if saved GP should be continued or not*/
bool m_continue_saved_gp;
public:
RaceManager();
@ -669,7 +672,8 @@ public:
* \brief Higher-level method to start a GP without having to care about
* the exact startup sequence
*/
void startGP(const GrandPrixData* gp, bool from_overworld);
void startGP(const GrandPrixData* gp, bool from_overworld,
bool continue_saved_gp);
/**
* \brief Higher-level method to start a GP without having to care about

View File

@ -140,6 +140,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
// ---- Start button
ButtonWidget* okBtn = new ButtonWidget();
ButtonWidget* continueBtn = new ButtonWidget();
SavedGrandPrix* saved_gp = SavedGrandPrix::getSavedGP( StateManager::get()
->getActivePlayerProfile(0)
@ -152,10 +153,10 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
if (gp_ok)
{
okBtn->m_properties[PROP_ID] = "start";
if (saved_gp)
okBtn->setText(_("Continue Grand Prix"));
else
okBtn->setText(_("Start Grand Prix"));
okBtn->setText(_("Start Grand Prix"));
continueBtn->m_properties[PROP_ID] = "continue";
continueBtn->setText(_("Continue"));
}
else
{
@ -164,7 +165,25 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
okBtn->setBadge(BAD_BADGE);
}
okBtn->m_x = m_area.getWidth()/2 - 200;
if (saved_gp && gp_ok)
{
continueBtn->m_x = m_area.getWidth()/2 + 110;
continueBtn->m_y = y2;
continueBtn->m_w = 200;
continueBtn->m_h = m_area.getHeight() - y2 - 15;
continueBtn->setParent(m_irrlicht_window);
m_widgets.push_back(continueBtn);
continueBtn->add();
continueBtn->getIrrlichtElement()->setTabStop(true);
continueBtn->getIrrlichtElement()->setTabGroup(false);
okBtn->m_x = m_area.getWidth()/2 - 310;
}
else
{
okBtn->m_x = m_area.getWidth()/2 - 200;
}
okBtn->m_y = y2;
okBtn->m_w = 400;
okBtn->m_h = m_area.getHeight() - y2 - 15;
@ -175,7 +194,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
okBtn->getIrrlichtElement()->setTabGroup(false);
okBtn->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
}
// ------------------------------------------------------------------------------------------------------
@ -201,7 +220,7 @@ void GPInfoDialog::onEnterPressedInternal()
ModalDialog::dismiss();
// Disable accidentally unlocking of a challenge
unlock_manager->getCurrentSlot()->setCurrentChallenge("");
race_manager->startGP(grand_prix_manager->getGrandPrix(gp_id), false);
race_manager->startGP(grand_prix_manager->getGrandPrix(gp_id), false, false);
}
// ------------------------------------------------------------------------------------------------------
@ -213,7 +232,15 @@ GUIEngine::EventPropagation GPInfoDialog::processEvent(const std::string& eventS
// Save GP identifier, since dismiss will delete this object.
std::string gp_id = m_gp_ident;
ModalDialog::dismiss();
race_manager->startGP(grand_prix_manager->getGrandPrix(gp_id), false);
race_manager->startGP(grand_prix_manager->getGrandPrix(gp_id), false, false);
return GUIEngine::EVENT_BLOCK;
}
if (eventSource == "continue")
{
// Save GP identifier, since dismiss will delete this object.
std::string gp_id = m_gp_ident;
ModalDialog::dismiss();
race_manager->startGP(grand_prix_manager->getGrandPrix(gp_id), false, true);
return GUIEngine::EVENT_BLOCK;
}
else if (eventSource == "cannot_start")