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