fixed bug with not warning on add/delete/paste of CE change pages when using level...
authorHolger Schemel <info@artsoft.org>
Thu, 26 Jan 2017 21:07:44 +0000 (22:07 +0100)
committerHolger Schemel <info@artsoft.org>
Thu, 26 Jan 2017 21:07:44 +0000 (22:07 +0100)
src/editor.c

index 49073d3..25b7af2 100644 (file)
@@ -11418,6 +11418,10 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi)
   {
     struct ElementInfo *ei = &element_info[properties_element];
 
+    /* when modifying custom element, ask for copying level template */
+    if (level.use_custom_template && !AskToCopyAndModifyLevelTemplate())
+      return;
+
     setElementChangePages(ei, ei->num_change_pages + 1);
 
     /* set new change page to be new current change page */
@@ -11435,6 +11439,10 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi)
   {
     struct ElementInfo *ei = &element_info[properties_element];
 
+    /* when modifying custom element, ask for copying level template */
+    if (level.use_custom_template && !AskToCopyAndModifyLevelTemplate())
+      return;
+
     /* copy all change pages after change page to be deleted */
     for (i = ei->current_change_page; i < ei->num_change_pages - 1; i++)
       ei->change_page[i] = ei->change_page[i + 1];
@@ -11474,10 +11482,16 @@ static void HandleGraphicbuttonGadgets(struct GadgetInfo *gi)
     int current_change_page = ei->current_change_page;
 
     if (type_id == ED_GRAPHICBUTTON_ID_COPY_CHANGE_PAGE)
+    {
       element_info[EL_INTERNAL_CLIPBOARD_CHANGE].change_page[0] =
        ei->change_page[current_change_page];
+    }
     else if (type_id == ED_GRAPHICBUTTON_ID_PASTE_CHANGE_PAGE)
     {
+      /* when modifying custom element, ask for copying level template */
+      if (level.use_custom_template && !AskToCopyAndModifyLevelTemplate())
+       return;
+
       ei->change_page[current_change_page] =
        element_info[EL_INTERNAL_CLIPBOARD_CHANGE].change_page[0];