Add more confirmation dialogue to the map editor

When saving on top of another map, or when saving on a map that has been edited outside the map editor
This commit is contained in:
Gustas
2022-08-08 20:31:41 +03:00
committed by Pavel Penev
parent d3589c051d
commit 11a2e6e19b
2 changed files with 50 additions and 10 deletions

View File

@@ -389,12 +389,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
// Show dialog only if updated since last save
button.OnClick = () =>
{
if (actionManager.HasUnsavedItems())
var map = modData.MapCache.GetUpdatedMap(world.Map.Uid);
var deletedOrUnavailable = map == null || modData.MapCache[map].Status != MapStatus.Available;
if (actionManager.HasUnsavedItems() || deletedOrUnavailable)
{
hideMenu = true;
ConfirmationDialogs.ButtonPrompt(
title: "Exit Map Editor",
text: "Exit and lose all unsaved changes?",
title: "Warning",
text: deletedOrUnavailable ? "The map may have been deleted outside the editor" : "Exit and lose all unsaved changes?",
confirmText: deletedOrUnavailable ? "Exit anyway" : "Exit",
onConfirm: OnQuit,
onCancel: ShowMenu);
}