From 1339faa5f411bc248b4ddf12696a5c4657f832dc Mon Sep 17 00:00:00 2001 From: Zachary Schirm Date: Tue, 13 Sep 2022 11:21:45 -0400 Subject: [PATCH] Disallowed Save Map without Title and Author Input --- OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs index 878e00b93f..92485df71f 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/SaveMapLogic.cs @@ -160,6 +160,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic var filename = widget.Get("FILENAME"); filename.Text = map.Package == null ? "" : mapIsUnpacked ? Path.GetFileName(map.Package.Name) : Path.GetFileNameWithoutExtension(map.Package.Name); + if (string.IsNullOrEmpty(filename.Text)) + filename.TakeKeyboardFocus(); + var fileType = mapIsUnpacked ? MapFileType.Unpacked : MapFileType.OraMap; var fileTypes = new Dictionary() @@ -231,11 +234,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic }; var save = widget.Get("SAVE_BUTTON"); + save.IsDisabled = () => string.IsNullOrWhiteSpace(filename.Text) || string.IsNullOrWhiteSpace(title.Text) || string.IsNullOrWhiteSpace(author.Text); + save.OnClick = () => { - if (string.IsNullOrEmpty(filename.Text)) - return; - var combinedPath = Platform.ResolvePath(Path.Combine(selectedDirectory.Folder.Name, filename.Text + fileTypes[fileType].Extension)); if (map.Package?.Name != combinedPath)