X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Feditor.c;h=49073d30d004043d6c35dd455426f15f936c70e0;hp=081e134d692628c9aa3ab8a4f801c3b23ad72acd;hb=ad5c7e778ae33255b403c0de955cfecc78a66b2c;hpb=c6d3f1920cf2aeffc05b1d00466ee66b4ac1adbc diff --git a/src/editor.c b/src/editor.c index 081e134d..49073d30 100644 --- a/src/editor.c +++ b/src/editor.c @@ -3505,6 +3505,7 @@ static void HandleCheckbuttons(struct GadgetInfo *); static void HandleControlButtons(struct GadgetInfo *); static void HandleDrawingAreaInfo(struct GadgetInfo *); static void PrintEditorGadgetInfoText(struct GadgetInfo *); +static boolean AskToCopyAndModifyLevelTemplate(); static int num_editor_gadgets = 0; /* dynamically determined */ @@ -7280,6 +7281,8 @@ static void replace_custom_element_in_playfield(int element_from, static boolean CopyCustomElement(int element_old, int element_new, int copy_mode) { + int copy_mode_orig = copy_mode; + if (copy_mode == GADGET_ID_CUSTOM_COPY) { element_new = (IS_CUSTOM_ELEMENT(element_old) ? @@ -7311,6 +7314,13 @@ static boolean CopyCustomElement(int element_old, int element_new, level.changed = TRUE; } + /* when modifying custom/group element, ask for copying level template */ + if (copy_mode_orig != GADGET_ID_CUSTOM_COPY && level.use_custom_template) + { + if (!AskToCopyAndModifyLevelTemplate()) + return FALSE; + } + if (copy_mode == GADGET_ID_CUSTOM_COPY_FROM) { copy_custom_element_settings(element_new, element_old); @@ -7516,7 +7526,7 @@ static void CopyElementPropertiesToEditor(int element) CopyClassicElementPropertiesToEditor(element); } -static void AskToCopyAndModifyLevelTemplate() +static boolean AskToCopyAndModifyLevelTemplate() { if (Request("Copy and modify level template?", REQ_ASK)) { @@ -7524,12 +7534,16 @@ static void AskToCopyAndModifyLevelTemplate() ModifyGadget(level_editor_gadget[GADGET_ID_CUSTOM_USE_TEMPLATE], GDI_CHECKED, FALSE, GDI_END); + + return TRUE; } else { LoadLevelTemplate(-1); /* this resets all element modifications ... */ DrawEditModeWindow(); /* ... and copies them to 'custom_element' */ + + return FALSE; } }