From: Holger Schemel Date: Thu, 26 Jan 2017 20:49:55 +0000 (+0100) Subject: fixed bug with not warning on copy/paste of CE/GE when using level template X-Git-Tag: 4.0.0.2~22 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ad5c7e778ae33255b403c0de955cfecc78a66b2c;p=rocksndiamonds.git fixed bug with not warning on copy/paste of CE/GE when using level template --- 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; } }