You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
// Add extra tab since the DataModule has everything indented
777
-
indexWriter.NewProperty("\tIncludeFile");
778
-
indexWriter << objectsFilePath;
779
-
}
780
-
}
781
-
*/
782
-
return m_HasEverBeenSaved = true;
783
-
}
784
-
else
785
-
{
786
-
// Gotto ask if we can overwrite the existing object
787
-
m_PreviousMode = EditorActivity::SAVEDIALOG;
788
-
m_EditorMode = EditorActivity::OVERWRITEDIALOG;
789
-
m_ModeChange = true;
790
-
}
791
-
792
-
returnfalse;
727
+
// Force overwrite the stored preset so we aren't prompted to every time for every preset. This doesn't screw with the original ini because there's no system for that in place
728
+
// and doesn't actually get loaded on the next game start either, so any changes will be discarded at the end of the current runtime.
729
+
if (g_PresetMan.AddEntityPreset(m_pEditedObject, m_ModuleSpaceID, true, objectSavePath)) {
730
+
// Show the overwrite dialog only when actually overwriting a saved ini in NewData or forcing an overwrite.
731
+
if (!System::PathExistsCaseSensitive(objectSavePath) || forceOverwrite) {
732
+
if (Writer objectWriter(objectSavePath, false); !objectWriter.WriterOK()) {
733
+
RTEError::ShowMessageBox("Failed to create Writer to path:\n\n" + objectSavePath + "\n\nTHE EDITED OBJECT PRESET WAS NOT SAVED!!!");
734
+
} else {
735
+
std::string addObjectType;
736
+
switch (m_pEditedObject->GetMOType()) {
737
+
case MovableObject::MOType::TypeActor:
738
+
addObjectType = "AddActor";
739
+
break;
740
+
case MovableObject::MOType::TypeHeldDevice:
741
+
case MovableObject::MOType::TypeThrownDevice:
742
+
addObjectType = "AddDevice";
743
+
break;
744
+
default:
745
+
addObjectType = "AddEffect";
746
+
}
747
+
objectWriter.NewProperty(addObjectType);
748
+
m_pEditedObject->Entity::Save(objectWriter);
749
+
for (const Gib &gib : *m_pEditedObject->GetGibList()) {
750
+
objectWriter.NewPropertyWithValue("AddGib", gib);
751
+
}
752
+
objectWriter.ObjectEnd();
753
+
objectWriter.EndWrite();
754
+
755
+
m_HasEverBeenSaved = true;
756
+
757
+
// TODO: Maybe make system for saving into/over the existing definition read originally from the ini's, wherever it was.
758
+
759
+
returntrue;
760
+
}
761
+
} else {
762
+
// Got to ask if we can overwrite the existing object.
/// Saves the current object to an appropriate ini file, and asks user if they want to overwrite first if object of this name exists.
215
+
/// </summary>
216
+
/// <param name="saveAsName">The name of the new object to be saved.</param>
217
+
/// <param name="forceOverwrite">Whether to force any existing Object of that name to be overwritten if it already exists.</param>
218
+
/// <returns>Whether actually managed to save. Will return false both if an object of this name already exists (and not overwriting), or if other error.</returns>
0 commit comments