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)
delete currentSave;
if(newSave == NULL)
currentSave = NULL;
else if(currentSave != newSave)
currentSave = new SaveInfo(*newSave);
{
if(currentSave)
delete currentSave;
if(newSave == NULL)
currentSave = NULL;
else
currentSave = new SaveInfo(*newSave);
}
if(currentSave && currentSave->GetGameSave())
{
@ -453,12 +456,15 @@ void GameModel::ClearSimulation()
void GameModel::SetStamp(GameSave * save)
{
if(stamp)
delete stamp;
if(save)
stamp = new GameSave(*save);
else
stamp = NULL;
if(stamp != save)
{
if(stamp)
delete stamp;
if(save)
stamp = new GameSave(*save);
else
stamp = NULL;
}
}
void GameModel::SetPlaceSave(GameSave * save)