fixed bug with asking to 'discard changes and use level template' if there were no...
authorHolger Schemel <info@artsoft.org>
Fri, 27 Jan 2017 19:38:51 +0000 (20:38 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 27 Jan 2017 19:39:09 +0000 (20:39 +0100)
src/editor.c

index b5aa6fb3c900f905c0a13b9d3c48f88ebcd75e9a..51ac61b211851e76e42e70c09e7c91661510d0b2 100644 (file)
@@ -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;