Fix stamp and save assignment

This commit is contained in:
Simon Robertshaw 2012-06-18 18:06:40 +01:00
parent 8c608ee8b9
commit f6403958de

View File

@ -280,11 +280,14 @@ SaveInfo * GameModel::GetSave()
void GameModel::SetSave(SaveInfo * newSave)
{
if(currentSave != newSave)
{
if(currentSave)
delete currentSave;
if(newSave == NULL)
currentSave = NULL;
else if(currentSave != newSave)
else
currentSave = new SaveInfo(*newSave);
}
if(currentSave && currentSave->GetGameSave())
{
@ -452,6 +455,8 @@ void GameModel::ClearSimulation()
}
void GameModel::SetStamp(GameSave * save)
{
if(stamp != save)
{
if(stamp)
delete stamp;
@ -460,6 +465,7 @@ void GameModel::SetStamp(GameSave * save)
else
stamp = NULL;
}
}
void GameModel::SetPlaceSave(GameSave * save)
{