1
0
mirror of https://github.com/The-Powder-Toy/The-Powder-Toy.git synced 2025-04-04 14:32:48 +02:00

Overwriting a local save now updates the reload button save, add message to confirm that local save was successful, fixes

This commit is contained in:
jacob1 2015-12-16 14:02:03 -05:00
parent 16e3532980
commit 8d4e333986

@ -1100,8 +1100,9 @@ void GameController::OpenLocalSaveWindow(bool asCurrent)
std::string filename = "";
if (gameModel->GetSaveFile())
filename = gameModel->GetSaveFile()->GetDisplayName();
filename = gameModel->GetSaveFile()->GetName();
SaveFile tempSave(filename);
tempSave.SetDisplayName(gameModel->GetSaveFile()->GetDisplayName());
tempSave.SetGameSave(gameSave);
if (!asCurrent || !gameModel->GetSaveFile())
@ -1122,9 +1123,12 @@ void GameController::OpenLocalSaveWindow(bool asCurrent)
}
else if (gameModel->GetSaveFile())
{
gameModel->SetSaveFile(&tempSave);
Client::Ref().MakeDirectory(LOCAL_SAVE_DIR);
if (Client::Ref().WriteFile(gameSave->Serialise(), gameModel->GetSaveFile()->GetName()))
new ErrorMessage("Error", "Unable to write save file.");
else
gameModel->SetInfoTip("Saved Successfully");
}
}
}