editor: Do copy the scenario before saving as a scenario

The deletion only happened when saving as a savegame.

C4Console::SaveScenario also is a much more natural place to do the
copying, since it already contained the part where the new path was copied
to Game.ScenarioFilename.
Günther Brammer 2011-10-12 20:47:08 +02:00
parent 8b3a96dcdb
commit 469eb4ddbc
1 changed files with 8 additions and 2 deletions

View File

@ -194,6 +194,14 @@ bool C4Console::SaveScenario(const char * path)
// Open new scenario file
if (path)
{
// Close current scenario file
Game.ScenarioFile.Close();
// Copy current scenario file to target
if (!C4Group_CopyItem(Game.ScenarioFilename,path))
{
Message(FormatString(LoadResStr("IDS_CNS_SAVEASERROR"),path).getData());
return false;
}
SCopy(path, Game.ScenarioFilename);
SetCaption(GetFilename(Game.ScenarioFilename));
if (!Game.ScenarioFile.Open(Game.ScenarioFilename))
@ -263,8 +271,6 @@ bool C4Console::FileSaveAs(bool fSaveGame)
OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY,
true)) return false;
DefaultExtension(&filename,"ocs");
// Close current scenario file
Game.ScenarioFile.Close();
if (fSaveGame)
// Save game
return SaveGame(filename.getData());