From: Holger Schemel Date: Thu, 26 Jan 2017 14:29:12 +0000 (+0100) Subject: fixed bug with not warning when editing GEs when using level template X-Git-Tag: 4.0.0.2~23 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=c6d3f1920cf2aeffc05b1d00466ee66b4ac1adbc;p=rocksndiamonds.git fixed bug with not warning when editing GEs when using level template --- diff --git a/src/editor.c b/src/editor.c index 6aa8b8d6..081e134d 100644 --- a/src/editor.c +++ b/src/editor.c @@ -7516,6 +7516,23 @@ static void CopyElementPropertiesToEditor(int element) CopyClassicElementPropertiesToEditor(element); } +static void AskToCopyAndModifyLevelTemplate() +{ + if (Request("Copy and modify level template?", REQ_ASK)) + { + level.use_custom_template = FALSE; + + ModifyGadget(level_editor_gadget[GADGET_ID_CUSTOM_USE_TEMPLATE], + GDI_CHECKED, FALSE, GDI_END); + } + else + { + LoadLevelTemplate(-1); /* this resets all element modifications ... */ + + DrawEditModeWindow(); /* ... and copies them to 'custom_element' */ + } +} + static void CopyCustomElementPropertiesToGame(int element) { int i; @@ -7526,20 +7543,7 @@ static void CopyCustomElementPropertiesToGame(int element) level.changed = TRUE; if (level.use_custom_template) - { - if (Request("Copy and modify level template?", REQ_ASK)) - { - level.use_custom_template = FALSE; - ModifyGadget(level_editor_gadget[GADGET_ID_CUSTOM_USE_TEMPLATE], - GDI_CHECKED, FALSE, GDI_END); - } - else - { - LoadLevelTemplate(-1); /* this resets all element modifications ... */ - - DrawEditModeWindow(); /* ... and copies them to 'custom_element' */ - } - } + AskToCopyAndModifyLevelTemplate(); element_info[element] = custom_element; *element_info[element].change = custom_element_change; @@ -7650,12 +7654,15 @@ static void CopyCustomElementPropertiesToGame(int element) static void CopyGroupElementPropertiesToGame(int element) { - element_info[element] = custom_element; - *element_info[element].group = group_element_info; - /* mark that this group element has been modified */ - element_info[element].modified_settings = TRUE; + custom_element.modified_settings = TRUE; level.changed = TRUE; + + if (level.use_custom_template) + AskToCopyAndModifyLevelTemplate(); + + element_info[element] = custom_element; + *element_info[element].group = group_element_info; } static void CopyClassicElementPropertiesToGame(int element)