From 8c3660a79a3ca587049365e4a1f1fad4ce063dc6 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 27 Jan 2017 20:38:51 +0100 Subject: [PATCH] fixed bug with asking to 'discard changes and use level template' if there were no CE/GE changes at all --- src/editor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/editor.c b/src/editor.c index b5aa6fb3..51ac61b2 100644 --- a/src/editor.c +++ b/src/editor.c @@ -11534,6 +11534,15 @@ static void HandleCheckbuttons(struct GadgetInfo *gi) } else if (type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE) { + boolean template_related_changes_found = FALSE; + int i; + + /* check if any custom or group elements have been changed */ + for (i = 0; i < NUM_FILE_ELEMENTS; i++) + if ((IS_CUSTOM_ELEMENT(i) || IS_GROUP_ELEMENT(i)) && + element_info[i].modified_settings) + template_related_changes_found = TRUE; + if (level.use_custom_template && !fileExists(getGlobalLevelTemplateFilename())) { @@ -11547,6 +11556,7 @@ static void HandleCheckbuttons(struct GadgetInfo *gi) } if (level.use_custom_template && + template_related_changes_found && !Request("Discard changes and use level template?", REQ_ASK)) { level.use_custom_template = FALSE; -- 2.34.1