added support for using non-local/shared level template file in level editor
authorHolger Schemel <info@artsoft.org>
Wed, 25 Jan 2017 20:36:31 +0000 (21:36 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 25 Jan 2017 20:36:31 +0000 (21:36 +0100)
src/editor.c
src/files.c

index 351818540394017ad7b7cdb725ed3cce722d19d6..507f9c3b71cfc71ed8a446898a57c26e3a42cfc7 100644 (file)
@@ -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;
index 0a170578461ea44d0a42021d707c8299c9844229..d7f59a722369cc7e0e82bfa2d46ed293fe8527b8 100644 (file)
@@ -7167,7 +7167,7 @@ void SaveLevel(int nr)
 
 void SaveLevelTemplate()
 {
-  char *filename = getDefaultLevelFilename(-1);
+  char *filename = getLocalLevelTemplateFilename();
 
   SaveLevelFromFilename(&level, filename);
 }