version 1.87 | | version 1.88 |
---|
| | |
/* | | /* |
* static char *rcsid_map_c = | | * static char *rcsid_map_c = |
* "$Id: map.c,v 1.87 2005/10/15 08:40:22 ryo_saeba Exp $"; | | * "$Id: map.c,v 1.88 2005/10/16 22:51:21 qal21 Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
} | | } |
| | |
/* | | /* |
| | * same as create_pathname, but for the template maps. |
| | */ |
| | |
| | const char *create_template_pathname (const char *name) { |
| | static char buf[MAX_BUF]; |
| | |
| | /* Why? having extra / doesn't confuse unix anyplace? Dependancies |
| | * someplace else in the code? msw 2-17-97 |
| | */ |
| | if (*name == '/') |
| | sprintf (buf, "%s/%s%s", settings.localdir, settings.templatedir, name); |
| | else |
| | sprintf (buf, "%s/%s/%s", settings.localdir, settings.templatedir, name); |
| | return (buf); |
| | } |
| | |
| | /* |
* This makes absolute path to the itemfile where unique objects | | * This makes absolute path to the itemfile where unique objects |
* will be saved. Converts '/' to '@'. I think it's essier maintain | | * will be saved. Converts '/' to '@'. I think it's essier maintain |
* files than full directory structure, but if this is problem it can | | * files than full directory structure, but if this is problem it can |
| | |
m->fixed_resettime = atoi(value); | | m->fixed_resettime = atoi(value); |
} else if (!strcmp(key,"unique")) { | | } else if (!strcmp(key,"unique")) { |
m->unique = atoi(value); | | m->unique = atoi(value); |
| | } else if (!strcmp(key,"template")) { |
| | m->template = atoi(value); |
} else if (!strcmp(key,"region")) { | | } else if (!strcmp(key,"region")) { |
m->region = get_region_by_name(value); | | m->region = get_region_by_name(value); |
} else if (!strcmp(key,"shopitems")) { | | } else if (!strcmp(key,"shopitems")) { |
| | |
return -1; | | return -1; |
} | | } |
| | |
if (flag || (m->unique)) { | | if (flag || (m->unique) || (m->template)) { |
if (!m->unique) { /* flag is set */ | | if (!m->unique && !m->template) { /* flag is set */ |
if (flag == 2) | | if (flag == 2) |
strcpy(filename, create_overlay_pathname(m->path)); | | strcpy(filename, create_overlay_pathname(m->path)); |
else | | else |
| | |
m->in_memory = MAP_SAVING; | | m->in_memory = MAP_SAVING; |
| | |
/* Compress if it isn't a temporary save. Do compress if unique */ | | /* Compress if it isn't a temporary save. Do compress if unique */ |
if (m->compressed && (m->unique || flag)) { | | if (m->compressed && (m->unique || m->template || flag)) { |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
strcpy(buf, uncomp[m->compressed][2]); | | strcpy(buf, uncomp[m->compressed][2]); |
strcat(buf, " > "); | | strcat(buf, " > "); |
| | |
if (m->enter_y) fprintf(fp,"enter_y %d\n", m->enter_y); | | if (m->enter_y) fprintf(fp,"enter_y %d\n", m->enter_y); |
if (m->msg) fprintf(fp,"msg\n%sendmsg\n", m->msg); | | if (m->msg) fprintf(fp,"msg\n%sendmsg\n", m->msg); |
if (m->unique) fprintf(fp,"unique %d\n", m->unique); | | if (m->unique) fprintf(fp,"unique %d\n", m->unique); |
| | if (m->template) fprintf(fp,"template %d\n", m->template); |
if (m->outdoor) fprintf(fp,"outdoor %d\n", m->outdoor); | | if (m->outdoor) fprintf(fp,"outdoor %d\n", m->outdoor); |
if (m->temp) fprintf(fp, "temp %d\n", m->temp); | | if (m->temp) fprintf(fp, "temp %d\n", m->temp); |
if (m->pressure) fprintf(fp, "pressure %d\n", m->pressure); | | if (m->pressure) fprintf(fp, "pressure %d\n", m->pressure); |
| | |
* player) | | * player) |
*/ | | */ |
fp2 = fp; /* save unique items into fp2 */ | | fp2 = fp; /* save unique items into fp2 */ |
if ((flag == 0 || flag == 2) && !m->unique) { | | if ((flag == 0 || flag == 2) && !m->unique && !m->template) { |
sprintf (buf,"%s.v00",create_items_path (m->path)); | | sprintf (buf,"%s.v00",create_items_path (m->path)); |
if ((fp2 = fopen (buf, "w")) == NULL) { | | if ((fp2 = fopen (buf, "w")) == NULL) { |
LOG(llevError, "Can't open unique items file %s\n", buf); | | LOG(llevError, "Can't open unique items file %s\n", buf); |
| | |
save_objects(m, fp, fp, 0); | | save_objects(m, fp, fp, 0); |
} | | } |
| | |
if (m->compressed && (m->unique || flag)) | | if (m->compressed && (m->unique || m->template || flag)) |
pclose(fp); | | pclose(fp); |
else | | else |
fclose(fp); | | fclose(fp); |