From: Holger Schemel Date: Wed, 25 Jan 2017 20:36:31 +0000 (+0100) Subject: added support for using non-local/shared level template file in level editor X-Git-Tag: 4.0.0.2~26 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=2adec83bef3e75ccb9af305cb44693c467c4d665;p=rocksndiamonds.git added support for using non-local/shared level template file in level editor --- diff --git a/src/editor.c b/src/editor.c index 35181854..507f9c3b 100644 --- a/src/editor.c +++ b/src/editor.c @@ -11376,8 +11376,7 @@ static void HandleTextbuttonGadgets(struct GadgetInfo *gi) } else if (type_id == ED_TEXTBUTTON_ID_SAVE_AS_TEMPLATE) { - char *template_filename = getDefaultLevelFilename(-1); - boolean new_template = !fileExists(template_filename); + boolean new_template = !fileExists(getLocalLevelTemplateFilename()); /* backup original "level.field" (needed to track playfield changes) */ CopyPlayfield(level.field, FieldBackup); @@ -11502,13 +11501,13 @@ static void HandleCheckbuttons(struct GadgetInfo *gi) } else if (type_id == ED_CHECKBUTTON_ID_CUSTOM_USE_TEMPLATE) { - char *template_filename = getDefaultLevelFilename(-1); - - if (level.use_custom_template && !fileExists(template_filename)) + if (level.use_custom_template && + !fileExists(getGlobalLevelTemplateFilename())) { Request("No level template found!", REQ_CONFIRM); level.use_custom_template = FALSE; + ModifyGadget(gi, GDI_CHECKED, FALSE, GDI_END); return; diff --git a/src/files.c b/src/files.c index 0a170578..d7f59a72 100644 --- a/src/files.c +++ b/src/files.c @@ -7167,7 +7167,7 @@ void SaveLevel(int nr) void SaveLevelTemplate() { - char *filename = getDefaultLevelFilename(-1); + char *filename = getLocalLevelTemplateFilename(); SaveLevelFromFilename(&level, filename); }