… | |
… | |
49 | printf ("\n"); |
49 | printf ("\n"); |
50 | } |
50 | } |
51 | } |
51 | } |
52 | printf ("\n"); |
52 | printf ("\n"); |
53 | } |
53 | } |
54 | EXTERN FILE *logfile; |
54 | |
|
|
55 | extern FILE *logfile; |
|
|
56 | |
55 | maptile * |
57 | maptile * |
56 | generate_random_map (const char *OutFileName, RMParms * RP) |
58 | generate_random_map (const char *OutFileName, RMParms * RP) |
57 | { |
59 | { |
58 | char **layout, buf[HUGE_BUF]; |
60 | char **layout, buf[HUGE_BUF]; |
59 | maptile *theMap; |
61 | maptile *theMap; |
… | |
… | |
111 | |
113 | |
112 | /* allocate the map and set the floor */ |
114 | /* allocate the map and set the floor */ |
113 | theMap = make_map_floor (layout, RP->floorstyle, RP); |
115 | theMap = make_map_floor (layout, RP->floorstyle, RP); |
114 | |
116 | |
115 | /* set the name of the map. */ |
117 | /* set the name of the map. */ |
116 | strcpy (theMap->path, OutFileName); |
118 | theMap->path = OutFileName; |
117 | |
119 | |
118 | /* set region */ |
120 | /* set region */ |
119 | theMap->region = RP->region; |
121 | theMap->region = RP->region; |
120 | |
122 | |
121 | /* create walls unless the wallstyle is "none" */ |
123 | /* create walls unless the wallstyle is "none" */ |
… | |
… | |
138 | /* create monsters unless the monsterstyle is "none" */ |
140 | /* create monsters unless the monsterstyle is "none" */ |
139 | if (strcmp (RP->monsterstyle, "none")) |
141 | if (strcmp (RP->monsterstyle, "none")) |
140 | place_monsters (theMap, RP->monsterstyle, RP->difficulty, RP); |
142 | place_monsters (theMap, RP->monsterstyle, RP->difficulty, RP); |
141 | |
143 | |
142 | /* treasures needs to have a proper difficulty set for the map. */ |
144 | /* treasures needs to have a proper difficulty set for the map. */ |
143 | theMap->difficulty = calculate_difficulty (theMap); |
145 | theMap->difficulty = theMap->estimate_difficulty (); |
144 | |
146 | |
145 | /* create treasure unless the treasurestyle is "none" */ |
147 | /* create treasure unless the treasurestyle is "none" */ |
146 | if (strcmp (RP->treasurestyle, "none")) |
148 | if (strcmp (RP->treasurestyle, "none")) |
147 | place_treasure (theMap, layout, RP->treasurestyle, RP->treasureoptions, RP); |
149 | place_treasure (theMap, layout, RP->treasurestyle, RP->treasureoptions, RP); |
148 | |
150 | |
… | |
… | |
158 | /* free the layout */ |
160 | /* free the layout */ |
159 | for (i = 0; i < RP->Xsize; i++) |
161 | for (i = 0; i < RP->Xsize; i++) |
160 | free (layout[i]); |
162 | free (layout[i]); |
161 | free (layout); |
163 | free (layout); |
162 | |
164 | |
163 | theMap->msg = strdup_local (buf); |
165 | theMap->msg = strdup (buf); |
164 | |
166 | |
165 | return theMap; |
167 | return theMap; |
166 | } |
168 | } |
167 | |
169 | |
168 | /* function selects the layout function and gives it whatever |
170 | /* function selects the layout function and gives it whatever |