version 1.28 | | version 1.29 |
---|
| | |
/* | | /* |
* static char *rcsid_random_map_c = | | * static char *rcsid_random_map_c = |
* "$Id: random_map.c,v 1.28 2001/10/07 06:45:40 mwedel Exp $"; | | * "$Id: random_map.c,v 1.29 2003/02/16 09:03:31 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
} | | } |
EXTERN FILE *logfile; | | EXTERN FILE *logfile; |
mapstruct *generate_random_map(char *OutFileName, RMParms *RP) { | | mapstruct *generate_random_map(char *OutFileName, RMParms *RP) { |
char **layout; | | char **layout, buf[HUGE_BUF]; |
mapstruct *theMap; | | mapstruct *theMap; |
| | int i; |
| | |
/* pick a random seed, or use the one from the input file */ | | /* pick a random seed, or use the one from the input file */ |
if(RP->random_seed == 0) SRANDOM(time(0)); | | if(RP->random_seed == 0) |
else SRANDOM(RP->random_seed); | | RP->random_seed=time(0); |
| | |
| | SRANDOM(RP->random_seed); |
| | |
| | write_map_parameters_to_string(buf, RP); |
| | |
if(RP->difficulty==0) | | if(RP->difficulty==0) |
RP->difficulty = RP->dungeon_level; /* use this instead of a map difficulty */ | | RP->difficulty = RP->dungeon_level; /* use this instead of a map difficulty */ |
| | |
#ifdef RMAP_DEBUG | | #ifdef RMAP_DEBUG |
dump_layout(layout,RP); | | dump_layout(layout,RP); |
#endif | | #endif |
| | |
/* allocate the map and set the floor */ | | /* allocate the map and set the floor */ |
theMap = make_map_floor(layout,RP->floorstyle,RP); | | theMap = make_map_floor(layout,RP->floorstyle,RP); |
| | |
| | |
| | |
place_monsters(theMap,RP->monsterstyle,RP->difficulty,RP); | | place_monsters(theMap,RP->monsterstyle,RP->difficulty,RP); |
| | |
/* treasures needs to have a proper difficulty set for | | /* treasures needs to have a proper difficulty set for the map. */ |
the map. */ | | |
theMap->difficulty=calculate_difficulty(theMap); | | theMap->difficulty=calculate_difficulty(theMap); |
| | |
place_treasure(theMap,layout,RP->treasurestyle,RP->treasureoptions,RP); | | place_treasure(theMap,layout,RP->treasurestyle,RP->treasureoptions,RP); |
| | |
fix_auto_apply(theMap); | | fix_auto_apply(theMap); |
| | |
unblock_exits(theMap,layout,RP); | | unblock_exits(theMap,layout,RP); |
/* fclose(OutFile); */ | | |
/*new_save_map(theMap,1);*/ | | |
| | |
/*free the layout */ | | /*free the layout */ |
{ int i; | | |
for(i=0;i<RP->Xsize;i++) | | for(i=0;i<RP->Xsize;i++) |
free(layout[i]); | | free(layout[i]); |
free(layout); | | free(layout); |
} | | |
| | theMap->msg = add_string(buf); |
| | |
return theMap; | | return theMap; |
} | | } |
| | |
strcat(buf,small_buf); | | strcat(buf,small_buf); |
} | | } |
if(RP->random_seed) { | | if(RP->random_seed) { |
sprintf(small_buf,"random_seed %d\n",RP->random_seed + 1); | | sprintf(small_buf,"random_seed %d\n",RP->random_seed); |
strcat(buf,small_buf); | | strcat(buf,small_buf); |
} | | } |
| | |
| | |
strcat(buf,small_buf); | | strcat(buf,small_buf); |
} | | } |
if(random_seed_n) { | | if(random_seed_n) { |
sprintf(small_buf,"random_seed %d\n",random_seed_n + 1); | | sprintf(small_buf,"random_seed %d\n",random_seed_n); |
strcat(buf,small_buf); | | strcat(buf,small_buf); |
} | | } |
| | |