Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 3fbead9

Browse files
committed
Only write Description for original presets in Entity::Save
Misc changes to editor save error messages
1 parent 83edd7d commit 3fbead9

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

Activities/AreaEditor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ bool AreaEditor::SaveScene(const std::string &saveAsName, bool forceOverwrite) {
617617

618618
if (g_PresetMan.AddEntityPreset(editedScene, m_ModuleSpaceID, forceOverwrite, sceneSavePath)) {
619619
if (Writer sceneWriter(sceneSavePath, false); !sceneWriter.WriterOK()) {
620-
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + sceneSavePath + "!\n\nTHE EDITED SCENE PRESET WAS NOT SAVED!!!");
620+
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + sceneSavePath + "\n\nTHE EDITED SCENE PRESET WAS NOT SAVED!!!");
621621
} else {
622622
// TODO: Check if the ini file already exists, and then ask if overwrite.
623623
sceneWriter.NewPropertyWithValue("AddScene", editedScene);
@@ -632,7 +632,7 @@ bool AreaEditor::SaveScene(const std::string &saveAsName, bool forceOverwrite) {
632632
bool scenesFileExists = System::PathExistsCaseSensitive(scenesFilePath);
633633

634634
if (Writer scenesFileWriter(scenesFilePath, true); !scenesFileWriter.WriterOK()) {
635-
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + scenesFilePath + "!\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
635+
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + scenesFilePath + "\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
636636
} else {
637637
scenesFileWriter.NewPropertyWithValue("IncludeFile", sceneSavePath);
638638
scenesFileWriter.EndWrite();
@@ -643,7 +643,7 @@ bool AreaEditor::SaveScene(const std::string &saveAsName, bool forceOverwrite) {
643643
std::string indexFilePath = dataModuleFullPath + "/Index.ini";
644644

645645
if (Writer indexWriter(indexFilePath, true); !indexWriter.WriterOK()) {
646-
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + indexFilePath + "!\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
646+
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + indexFilePath + "\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
647647
} else {
648648
// Add extra tab since the DataModule has everything indented.
649649
indexWriter.NewProperty("\tIncludeFile");

Activities/AssemblyEditor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ bool AssemblyEditor::SaveAssembly(const std::string &saveAsName, bool forceOverw
632632

633633
if (g_PresetMan.AddEntityPreset(editedAssembly.get(), m_ModuleSpaceID, forceOverwrite, assemblySavePath)) {
634634
if (Writer assemblyWriter(assemblySavePath, false); !assemblyWriter.WriterOK()) {
635-
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + assemblySavePath + "!\n\nTHE EDITED BUNKER ASSEMBLY PRESET WAS NOT SAVED!!!");
635+
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + assemblySavePath + "\n\nTHE EDITED BUNKER ASSEMBLY PRESET WAS NOT SAVED!!!");
636636
} else {
637637
// TODO: Check if the ini file already exists, and then ask if overwrite.
638638
assemblyWriter.NewPropertyWithValue("AddBunkerAssembly", editedAssembly.get());
@@ -646,7 +646,7 @@ bool AssemblyEditor::SaveAssembly(const std::string &saveAsName, bool forceOverw
646646
bool assembliesFileExists = System::PathExistsCaseSensitive(assembliesFilePath);
647647

648648
if (Writer assembliesFileWriter(assembliesFilePath, true); !assembliesFileWriter.WriterOK()) {
649-
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + assembliesFilePath + "!\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
649+
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + assembliesFilePath + "\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
650650
} else {
651651
assembliesFileWriter.NewPropertyWithValue("IncludeFile", assemblySavePath);
652652
assembliesFileWriter.EndWrite();
@@ -657,7 +657,7 @@ bool AssemblyEditor::SaveAssembly(const std::string &saveAsName, bool forceOverw
657657
std::string indexFilePath = dataModuleFullPath + "/Index.ini";
658658

659659
if (Writer indexWriter(indexFilePath, true); !indexWriter.WriterOK()) {
660-
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + indexFilePath + "!\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
660+
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + indexFilePath + "\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
661661
} else {
662662
// Add extra tab since the DataModule has everything indented.
663663
indexWriter.NewProperty("\tIncludeFile");

Activities/SceneEditor.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ bool SceneEditor::SaveScene(const std::string &saveAsName, bool forceOverwrite)
670670

671671
if (g_PresetMan.AddEntityPreset(editedScene, m_ModuleSpaceID, forceOverwrite, sceneSavePath)) {
672672
if (Writer sceneWriter(sceneSavePath, false); !sceneWriter.WriterOK()) {
673-
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + sceneSavePath + "!\n\nTHE EDITED SCENE PRESET WAS NOT SAVED!!!");
673+
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + sceneSavePath + "\n\nTHE EDITED SCENE PRESET WAS NOT SAVED!!!");
674674
} else {
675675
// TODO: Check if the ini file already exists, and then ask if overwrite.
676676
sceneWriter.NewPropertyWithValue("AddScene", editedScene);
@@ -685,7 +685,7 @@ bool SceneEditor::SaveScene(const std::string &saveAsName, bool forceOverwrite)
685685
bool scenesFileExists = System::PathExistsCaseSensitive(scenesFilePath);
686686

687687
if (Writer scenesFileWriter(scenesFilePath, true); !scenesFileWriter.WriterOK()) {
688-
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + scenesFilePath + "!\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
688+
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + scenesFilePath + "\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
689689
} else {
690690
scenesFileWriter.NewPropertyWithValue("IncludeFile", sceneSavePath);
691691
scenesFileWriter.EndWrite();
@@ -696,7 +696,7 @@ bool SceneEditor::SaveScene(const std::string &saveAsName, bool forceOverwrite)
696696
std::string indexFilePath = dataModuleFullPath + "/Index.ini";
697697

698698
if (Writer indexWriter(indexFilePath, true); !indexWriter.WriterOK()) {
699-
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + indexFilePath + "!\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
699+
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + indexFilePath + "\n\nThe edited Scene preset was saved but will not be loaded on next game start!\nPlease include the Scene preset manually!");
700700
} else {
701701
// Add extra tab since the DataModule has everything indented.
702702
indexWriter.NewProperty("\tIncludeFile");

System/Entity.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,14 @@ namespace RTE {
102102
// Is an original preset definition
103103
if (m_IsOriginalPreset) {
104104
writer.NewPropertyWithValue("PresetName", m_PresetName);
105+
106+
if (!m_PresetDescription.empty()) {
107+
writer.NewPropertyWithValue("Description", m_PresetDescription);
108+
}
105109
// Only write out a copy reference if there is one
106110
} else if (!m_PresetName.empty() && m_PresetName != "None") {
107111
writer.NewPropertyWithValue("CopyOf", GetModuleAndPresetName());
108112
}
109-
if (!m_PresetDescription.empty()) { writer.NewPropertyWithValue("Description", m_PresetDescription); }
110113

111114
// TODO: Make proper save system that knows not to save redundant data!
112115
/*

0 commit comments

Comments
 (0)