GameModel manages currentSave instance

This commit is contained in:
Simon Robertshaw 2012-06-18 16:43:40 +01:00
parent 5e301ba17c
commit 7ffaa421d1
2 changed files with 8 additions and 2 deletions

View File

@ -38,7 +38,7 @@ public:
{
try
{
cc->gameModel->SetSave(new SaveInfo(*(cc->search->GetLoadedSave())));
cc->gameModel->SetSave(cc->search->GetLoadedSave());
}
catch(GameModelException & ex)
{

View File

@ -182,6 +182,8 @@ GameModel::~GameModel()
delete clipboard;
if(stamp)
delete stamp;
if(currentSave)
delete currentSave;
//if(activeTools)
// delete[] activeTools;
}
@ -279,7 +281,11 @@ void GameModel::SetSave(SaveInfo * newSave)
{
if(currentSave != newSave)
delete currentSave;
currentSave = newSave;
if(newSave == NULL)
currentSave = NULL;
else if(currentSave != newSave)
currentSave = new SaveInfo(*newSave);
if(currentSave && currentSave->GetGameSave())
{
GameSave * saveData = currentSave->GetGameSave();