Remove saved GPs only in offline mode during starting new race

This commit is contained in:
Deve 2015-01-07 21:19:04 +01:00
parent 2d9e38f7f6
commit 57ab9e5ac5

View File

@ -297,30 +297,34 @@ void RaceManager::startNew(bool from_overworld)
m_num_laps = m_grand_prix.getLaps();
m_reverse_track = m_grand_prix.getReverse();
// We look if Player 1 has a saved version of this GP.
m_saved_gp = SavedGrandPrix::getSavedGP(
StateManager::get()
->getActivePlayerProfile(0)
->getUniqueID(),
m_grand_prix.getId(),
m_player_karts.size());
// Saved GP only in offline mode
if (m_continue_saved_gp && !NetworkWorld::getInstance<NetworkWorld>()->isRunning())
if (!NetworkWorld::getInstance<NetworkWorld>()->isRunning())
{
if (m_saved_gp == NULL)
// We look if Player 1 has a saved version of this GP.
m_saved_gp = SavedGrandPrix::getSavedGP(
StateManager::get()
->getActivePlayerProfile(0)
->getUniqueID(),
m_grand_prix.getId(),
m_player_karts.size());
// Saved GP only in offline mode
if (m_continue_saved_gp)
{
Log::error("Race Manager", "Can not continue Grand Prix '%s'"
"because it could not exist",
m_grand_prix.getId().c_str());
m_continue_saved_gp = false; // simple and working
}
else
{
setNumKarts(m_saved_gp->getTotalKarts());
setupPlayerKartInfo();
m_grand_prix.changeReverse((GrandPrixData::GPReverseType)m_saved_gp->getReverseType());
m_reverse_track = m_grand_prix.getReverse();
if (m_saved_gp == NULL)
{
Log::error("Race Manager", "Can not continue Grand Prix '%s'"
"because it could not exist",
m_grand_prix.getId().c_str());
m_continue_saved_gp = false; // simple and working
}
else
{
setNumKarts(m_saved_gp->getTotalKarts());
setupPlayerKartInfo();
m_grand_prix.changeReverse((GrandPrixData::GPReverseType)
m_saved_gp->getReverseType());
m_reverse_track = m_grand_prix.getReverse();
}
}
}
}