version 1.70 | | version 1.71 |
---|
| | |
/* | | /* |
* static char *rcsid_main_c = | | * static char *rcsid_main_c = |
* "$Id: main.c,v 1.70 2002/12/03 07:40:18 mwedel Exp $"; | | * "$Id: main.c,v 1.71 2003/01/05 23:50:15 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
static void enter_random_map(object *pl, object *exit_ob) | | static void enter_random_map(object *pl, object *exit_ob) |
{ | | { |
mapstruct *new_map; | | mapstruct *new_map; |
char newmap_name[HUGE_BUF]; | | char newmap_name[HUGE_BUF], *cp; |
static int reference_number = 0; | | static int reference_number = 0; |
RMParms rp; | | RMParms rp; |
| | |
| | |
rp.generate_treasure_now = 1; | | rp.generate_treasure_now = 1; |
strcpy(rp.origin_map, pl->map->path); | | strcpy(rp.origin_map, pl->map->path); |
| | |
/* pick a new pathname for the new map. Currently, we just | | /* If we have a final_map, use it as a base name to give some clue |
* use a static variable and increment the counter one each time. | | * as where the player is. Otherwise, use the origin map. |
*/ | | * Take the last component (after the last slash) to give |
sprintf(newmap_name,"/random/%016d",reference_number++); | | * shorter names without bogus slashes. |
| | */ |
| | cp = strrchr(rp.final_map[0]? rp.final_map:rp.origin_map, '/'); |
| | if (!cp) |
| | cp = rp.final_map[0]? rp.final_map:rp.origin_map; |
| | |
| | sprintf(newmap_name,"/random/%s%04d",cp+1, reference_number++); |
| | |
/* now to generate the actual map. */ | | /* now to generate the actual map. */ |
new_map=(mapstruct *)generate_random_map(newmap_name,&rp); | | new_map=(mapstruct *)generate_random_map(newmap_name,&rp); |