Don't create new GP save when it's already created

This commit is contained in:
Deve 2015-01-07 18:32:32 +01:00
parent 798c2b5355
commit cd9bd36520

View File

@ -516,17 +516,7 @@ void RaceManager::next()
if(m_major_mode==MAJOR_MODE_GRAND_PRIX && !NetworkWorld::getInstance()->isRunning())
{
// Saving GP state
// If Player 1 has already saved a GP, we adapt it
if(m_saved_gp != NULL)
{
m_saved_gp->setKarts(m_kart_status);
m_saved_gp->setNextTrack(m_track_number);
user_config->saveConfig();
}
else
{
saveGP();
}
saveGP();
}
startNextRace();
}
@ -539,18 +529,26 @@ void RaceManager::next()
//-----------------------------------------------------------------------------
void RaceManager::saveGP()
{
UserConfigParams::m_saved_grand_prix_list.push_back(
new SavedGrandPrix(
StateManager::get()->getActivePlayerProfile(0)
->getUniqueID(),
// If Player 1 has already saved a GP, we adapt it
if(m_saved_gp != NULL)
{
m_saved_gp->setKarts(m_kart_status);
m_saved_gp->setNextTrack(m_track_number);
}
else
{
m_saved_gp = new SavedGrandPrix(
StateManager::get()->getActivePlayerProfile(0)->getUniqueID(),
m_grand_prix.getId(),
m_difficulty,
(int)m_player_karts.size(),
m_track_number,
m_grand_prix.getReverseType(),
m_kart_status
)
);
m_kart_status);
UserConfigParams::m_saved_grand_prix_list.push_back(m_saved_gp);
}
user_config->saveConfig();
}