From: Holger Schemel Date: Fri, 27 Jan 2017 19:38:51 +0000 (+0100) Subject: fixed bug with asking to 'discard changes and use level template' if there were no... X-Git-Tag: 4.0.0.2~19 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8c3660a79a3ca587049365e4a1f1fad4ce063dc6;p=rocksndiamonds.git fixed bug with asking to 'discard changes and use level template' if there were no CE/GE changes at all --- diff --git a/src/editor.c b/src/editor.c index b5aa6fb3..51ac61b2 100644 --- a/src/editor.c +++ b/src/editor.c @@ -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;