From: Holger Schemel Date: Fri, 27 Jan 2017 21:18:28 +0000 (+0100) Subject: fixed potentially disastrous bug with destroying level template when saving template... X-Git-Tag: 4.0.0.2~15 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=a765a89dce5dd3d870906dbe4580b62313117417;p=rocksndiamonds.git fixed potentially disastrous bug with destroying level template when saving template while using template --- diff --git a/src/files.c b/src/files.c index d7f59a72..b55395f4 100644 --- a/src/files.c +++ b/src/files.c @@ -7062,7 +7062,8 @@ static int SaveLevel_GRPX(FILE *file, struct LevelInfo *level, int element) return chunk_size; } -static void SaveLevelFromFilename(struct LevelInfo *level, char *filename) +static void SaveLevelFromFilename(struct LevelInfo *level, char *filename, + boolean save_as_template) { int chunk_size; int i; @@ -7126,7 +7127,7 @@ static void SaveLevelFromFilename(struct LevelInfo *level, char *filename) } /* if not using template level, check for non-default custom/group elements */ - if (!level->use_custom_template) + if (!level->use_custom_template || save_as_template) { for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++) { @@ -7162,14 +7163,14 @@ void SaveLevel(int nr) { char *filename = getDefaultLevelFilename(nr); - SaveLevelFromFilename(&level, filename); + SaveLevelFromFilename(&level, filename, FALSE); } void SaveLevelTemplate() { char *filename = getLocalLevelTemplateFilename(); - SaveLevelFromFilename(&level, filename); + SaveLevelFromFilename(&level, filename, TRUE); } boolean SaveLevelChecked(int nr)