ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/random_map.C
(Generate patch)

Comparing deliantra/server/random_maps/random_map.C (file contents):
Revision 1.10 by root, Sat Dec 30 10:16:11 2006 UTC vs.
Revision 1.11 by root, Sat Dec 30 18:45:28 2006 UTC

29#include <random_map.h> 29#include <random_map.h>
30#include <rproto.h> 30#include <rproto.h>
31#include <sproto.h> 31#include <sproto.h>
32 32
33void 33void
34dump_layout (char **layout, RMParms * RP) 34dump_layout (char **layout, random_map_params * RP)
35{ 35{
36 { 36 {
37 int i, j; 37 int i, j;
38 38
39 for (i = 0; i < RP->Xsize; i++) 39 for (i = 0; i < RP->Xsize; i++)
53} 53}
54 54
55extern FILE *logfile; 55extern FILE *logfile;
56 56
57maptile * 57maptile *
58generate_random_map (const char *OutFileName, RMParms * RP) 58generate_random_map (const char *OutFileName, random_map_params * RP)
59{ 59{
60 char **layout, buf[HUGE_BUF]; 60 char **layout, buf[HUGE_BUF];
61 maptile *theMap; 61 maptile *theMap;
62 int i; 62 int i;
63 63
151 /* create decor unless the decorstyle is "none" */ 151 /* create decor unless the decorstyle is "none" */
152 if (strcmp (RP->decorstyle, "none")) 152 if (strcmp (RP->decorstyle, "none"))
153 put_decor (theMap, layout, RP->decorstyle, RP->decoroptions, RP); 153 put_decor (theMap, layout, RP->decorstyle, RP->decoroptions, RP);
154 154
155 /* generate treasures, etc. */ 155 /* generate treasures, etc. */
156 fix_auto_apply (theMap); 156 theMap->fix_auto_apply ();
157 157
158 unblock_exits (theMap, layout, RP); 158 unblock_exits (theMap, layout, RP);
159 159
160 /* free the layout */ 160 /* free the layout */
161 for (i = 0; i < RP->Xsize; i++) 161 for (i = 0; i < RP->Xsize; i++)
168} 168}
169 169
170/* function selects the layout function and gives it whatever 170/* function selects the layout function and gives it whatever
171 arguments it needs. */ 171 arguments it needs. */
172char ** 172char **
173layoutgen (RMParms * RP) 173layoutgen (random_map_params * RP)
174{ 174{
175 char **maze = 0; 175 char **maze = 0;
176 int oxsize = RP->Xsize, oysize = RP->Ysize; 176 int oxsize = RP->Xsize, oysize = RP->Ysize;
177 177
178 if (RP->symmetry == RANDOM_SYM) 178 if (RP->symmetry == SYMMETRY_RANDOM)
179 RP->symmetry_used = (RANDOM () % (XY_SYM)) + 1; 179 RP->symmetry_used = (RANDOM () % (SYMMETRY_XY)) + 1;
180 else 180 else
181 RP->symmetry_used = RP->symmetry; 181 RP->symmetry_used = RP->symmetry;
182 182
183 if (RP->symmetry_used == Y_SYM || RP->symmetry_used == XY_SYM) 183 if (RP->symmetry_used == SYMMETRY_Y || RP->symmetry_used == SYMMETRY_XY)
184 RP->Ysize = RP->Ysize / 2 + 1; 184 RP->Ysize = RP->Ysize / 2 + 1;
185 if (RP->symmetry_used == X_SYM || RP->symmetry_used == XY_SYM) 185 if (RP->symmetry_used == SYMMETRY_X || RP->symmetry_used == SYMMETRY_XY)
186 RP->Xsize = RP->Xsize / 2 + 1; 186 RP->Xsize = RP->Xsize / 2 + 1;
187 187
188 if (RP->Xsize < MIN_RANDOM_MAP_SIZE) 188 if (RP->Xsize < MIN_RANDOM_MAP_SIZE)
189 RP->Xsize = MIN_RANDOM_MAP_SIZE + RANDOM () % 5; 189 RP->Xsize = MIN_RANDOM_MAP_SIZE + RANDOM () % 5;
190 if (RP->Ysize < MIN_RANDOM_MAP_SIZE) 190 if (RP->Ysize < MIN_RANDOM_MAP_SIZE)
195 * layout style and then random layout style. Instead, figure out 195 * layout style and then random layout style. Instead, figure out
196 * the numeric layoutstyle, so there is only one area that actually 196 * the numeric layoutstyle, so there is only one area that actually
197 * calls the code to make the maps. 197 * calls the code to make the maps.
198 */ 198 */
199 if (strstr (RP->layoutstyle, "onion")) 199 if (strstr (RP->layoutstyle, "onion"))
200 {
201 RP->map_layout_style = ONION_LAYOUT; 200 RP->map_layout_style = LAYOUT_ONION;
202 }
203 201
204 if (strstr (RP->layoutstyle, "maze")) 202 if (strstr (RP->layoutstyle, "maze"))
205 {
206 RP->map_layout_style = MAZE_LAYOUT; 203 RP->map_layout_style = LAYOUT_MAZE;
207 }
208 204
209 if (strstr (RP->layoutstyle, "spiral")) 205 if (strstr (RP->layoutstyle, "spiral"))
210 {
211 RP->map_layout_style = SPIRAL_LAYOUT; 206 RP->map_layout_style = LAYOUT_SPIRAL;
212 }
213 207
214 if (strstr (RP->layoutstyle, "rogue")) 208 if (strstr (RP->layoutstyle, "rogue"))
215 {
216 RP->map_layout_style = ROGUELIKE_LAYOUT; 209 RP->map_layout_style = LAYOUT_ROGUELIKE;
217 }
218 210
219 if (strstr (RP->layoutstyle, "snake")) 211 if (strstr (RP->layoutstyle, "snake"))
220 {
221 RP->map_layout_style = SNAKE_LAYOUT; 212 RP->map_layout_style = LAYOUT_SNAKE;
222 }
223 213
224 if (strstr (RP->layoutstyle, "squarespiral")) 214 if (strstr (RP->layoutstyle, "squarespiral"))
225 {
226 RP->map_layout_style = SQUARE_SPIRAL_LAYOUT; 215 RP->map_layout_style = LAYOUT_SQUARE_SPIRAL;
227 } 216
228 /* No style found - choose one ranomdly */ 217 /* No style found - choose one ranomdly */
229 if (RP->map_layout_style == 0) 218 if (RP->map_layout_style == LAYOUT_NONE)
230 {
231 RP->map_layout_style = (RANDOM () % NROFLAYOUTS) + 1; 219 RP->map_layout_style = (RANDOM () % (NROFLAYOUTS - 1)) + 1;
232 }
233 220
234 switch (RP->map_layout_style) 221 switch (RP->map_layout_style)
235 { 222 {
236 223 case LAYOUT_ONION:
237 case ONION_LAYOUT:
238 maze = map_gen_onion (RP->Xsize, RP->Ysize, RP->layoutoptions1, RP->layoutoptions2); 224 maze = map_gen_onion (RP->Xsize, RP->Ysize, RP->layoutoptions1, RP->layoutoptions2);
239 if (!(RANDOM () % 3) && !(RP->layoutoptions1 & OPT_WALLS_ONLY)) 225 if (!(RANDOM () % 3) && !(RP->layoutoptions1 & RMOPT_WALLS_ONLY))
240 roomify_layout (maze, RP); 226 roomify_layout (maze, RP);
241 break; 227 break;
242 228
243 case MAZE_LAYOUT: 229 case LAYOUT_MAZE:
244 maze = maze_gen (RP->Xsize, RP->Ysize, RANDOM () % 2); 230 maze = maze_gen (RP->Xsize, RP->Ysize, RANDOM () % 2);
245 if (!(RANDOM () % 2)) 231 if (!(RANDOM () % 2))
246 doorify_layout (maze, RP); 232 doorify_layout (maze, RP);
247 break; 233 break;
248 234
249 case SPIRAL_LAYOUT: 235 case LAYOUT_SPIRAL:
250 maze = map_gen_spiral (RP->Xsize, RP->Ysize, RP->layoutoptions1); 236 maze = map_gen_spiral (RP->Xsize, RP->Ysize, RP->layoutoptions1);
251 if (!(RANDOM () % 2)) 237 if (!(RANDOM () % 2))
252 doorify_layout (maze, RP); 238 doorify_layout (maze, RP);
253 break; 239 break;
254 240
255 case ROGUELIKE_LAYOUT: 241 case LAYOUT_ROGUELIKE:
256 /* Don't put symmetry in rogue maps. There isn't much reason to 242 /* Don't put symmetry in rogue maps. There isn't much reason to
257 * do so in the first place (doesn't make it any more interesting), 243 * do so in the first place (doesn't make it any more interesting),
258 * but more importantly, the symmetry code presumes we are symmetrizing 244 * but more importantly, the symmetry code presumes we are symmetrizing
259 * spirals, or maps with lots of passages - making a symmetric rogue 245 * spirals, or maps with lots of passages - making a symmetric rogue
260 * map fails because its likely that the passages the symmetry process 246 * map fails because its likely that the passages the symmetry process
261 * creates may not connect the rooms. 247 * creates may not connect the rooms.
262 */ 248 */
263 RP->symmetry_used = NO_SYM; 249 RP->symmetry_used = SYMMETRY_NONE;
264 RP->Ysize = oysize; 250 RP->Ysize = oysize;
265 RP->Xsize = oxsize; 251 RP->Xsize = oxsize;
266 maze = roguelike_layout_gen (RP->Xsize, RP->Ysize, RP->layoutoptions1); 252 maze = roguelike_layout_gen (RP->Xsize, RP->Ysize, RP->layoutoptions1);
267 /* no doorifying... done already */ 253 /* no doorifying... done already */
268 break; 254 break;
269 255
270 case SNAKE_LAYOUT: 256 case LAYOUT_SNAKE:
271 maze = make_snake_layout (RP->Xsize, RP->Ysize, RP->layoutoptions1); 257 maze = make_snake_layout (RP->Xsize, RP->Ysize, RP->layoutoptions1);
272 if (RANDOM () % 2) 258 if (RANDOM () % 2)
273 roomify_layout (maze, RP); 259 roomify_layout (maze, RP);
274 break; 260 break;
275 261
276 case SQUARE_SPIRAL_LAYOUT: 262 case LAYOUT_SQUARE_SPIRAL:
277 maze = make_square_spiral_layout (RP->Xsize, RP->Ysize, RP->layoutoptions1); 263 maze = make_square_spiral_layout (RP->Xsize, RP->Ysize, RP->layoutoptions1);
278 if (RANDOM () % 2) 264 if (RANDOM () % 2)
279 roomify_layout (maze, RP); 265 roomify_layout (maze, RP);
280 break; 266 break;
281 } 267 }
282 268
283 maze = symmetrize_layout (maze, RP->symmetry_used, RP); 269 maze = symmetrize_layout (maze, RP->symmetry_used, RP);
270
284#ifdef RMAP_DEBUG 271#ifdef RMAP_DEBUG
285 dump_layout (maze, RP); 272 dump_layout (maze, RP);
286#endif 273#endif
274
287 if (RP->expand2x) 275 if (RP->expand2x)
288 { 276 {
289 maze = expand2x (maze, RP->Xsize, RP->Ysize); 277 maze = expand2x (maze, RP->Xsize, RP->Ysize);
290 RP->Xsize = RP->Xsize * 2 - 1; 278 RP->Xsize = RP->Xsize * 2 - 1;
291 RP->Ysize = RP->Ysize * 2 - 1; 279 RP->Ysize = RP->Ysize * 2 - 1;
292 } 280 }
281
293 return maze; 282 return maze;
294} 283}
295
296 284
297/* takes a map and makes it symmetric: adjusts Xsize and 285/* takes a map and makes it symmetric: adjusts Xsize and
298Ysize to produce a symmetric map. */ 286Ysize to produce a symmetric map. */
299
300char ** 287char **
301symmetrize_layout (char **maze, int sym, RMParms * RP) 288symmetrize_layout (char **maze, int sym, random_map_params * RP)
302{ 289{
303 int i, j; 290 int i, j;
304 char **sym_maze; 291 char **sym_maze;
305 int Xsize_orig, Ysize_orig; 292 int Xsize_orig, Ysize_orig;
306 293
307 Xsize_orig = RP->Xsize; 294 Xsize_orig = RP->Xsize;
308 Ysize_orig = RP->Ysize; 295 Ysize_orig = RP->Ysize;
309 RP->symmetry_used = sym; /* tell everyone else what sort of symmetry is used. */ 296 RP->symmetry_used = sym; /* tell everyone else what sort of symmetry is used. */
310 if (sym == NO_SYM) 297 if (sym == SYMMETRY_NONE)
311 { 298 {
312 RP->Xsize = Xsize_orig; 299 RP->Xsize = Xsize_orig;
313 RP->Ysize = Ysize_orig; 300 RP->Ysize = Ysize_orig;
314 return maze; 301 return maze;
315 } 302 }
316 /* pick new sizes */ 303 /* pick new sizes */
317 RP->Xsize = ((sym == X_SYM || sym == XY_SYM) ? RP->Xsize * 2 - 3 : RP->Xsize); 304 RP->Xsize = ((sym == SYMMETRY_X || sym == SYMMETRY_XY) ? RP->Xsize * 2 - 3 : RP->Xsize);
318 RP->Ysize = ((sym == Y_SYM || sym == XY_SYM) ? RP->Ysize * 2 - 3 : RP->Ysize); 305 RP->Ysize = ((sym == SYMMETRY_Y || sym == SYMMETRY_XY) ? RP->Ysize * 2 - 3 : RP->Ysize);
319 306
320 sym_maze = (char **) calloc (sizeof (char *), RP->Xsize); 307 sym_maze = (char **) calloc (sizeof (char *), RP->Xsize);
321 for (i = 0; i < RP->Xsize; i++) 308 for (i = 0; i < RP->Xsize; i++)
322 sym_maze[i] = (char *) calloc (sizeof (char), RP->Ysize); 309 sym_maze[i] = (char *) calloc (sizeof (char), RP->Ysize);
323 310
324 if (sym == X_SYM) 311 if (sym == SYMMETRY_X)
325 for (i = 0; i < RP->Xsize / 2 + 1; i++) 312 for (i = 0; i < RP->Xsize / 2 + 1; i++)
326 for (j = 0; j < RP->Ysize; j++) 313 for (j = 0; j < RP->Ysize; j++)
327 { 314 {
328 sym_maze[i][j] = maze[i][j]; 315 sym_maze[i][j] = maze[i][j];
329 sym_maze[RP->Xsize - i - 1][j] = maze[i][j]; 316 sym_maze[RP->Xsize - i - 1][j] = maze[i][j];
330 }; 317 };
331 if (sym == Y_SYM) 318 if (sym == SYMMETRY_Y)
332 for (i = 0; i < RP->Xsize; i++) 319 for (i = 0; i < RP->Xsize; i++)
333 for (j = 0; j < RP->Ysize / 2 + 1; j++) 320 for (j = 0; j < RP->Ysize / 2 + 1; j++)
334 { 321 {
335 sym_maze[i][j] = maze[i][j]; 322 sym_maze[i][j] = maze[i][j];
336 sym_maze[i][RP->Ysize - j - 1] = maze[i][j]; 323 sym_maze[i][RP->Ysize - j - 1] = maze[i][j];
337 } 324 }
338 if (sym == XY_SYM) 325 if (sym == SYMMETRY_XY)
339 for (i = 0; i < RP->Xsize / 2 + 1; i++) 326 for (i = 0; i < RP->Xsize / 2 + 1; i++)
340 for (j = 0; j < RP->Ysize / 2 + 1; j++) 327 for (j = 0; j < RP->Ysize / 2 + 1; j++)
341 { 328 {
342 sym_maze[i][j] = maze[i][j]; 329 sym_maze[i][j] = maze[i][j];
343 sym_maze[i][RP->Ysize - j - 1] = maze[i][j]; 330 sym_maze[i][RP->Ysize - j - 1] = maze[i][j];
347 /* delete the old maze */ 334 /* delete the old maze */
348 for (i = 0; i < Xsize_orig; i++) 335 for (i = 0; i < Xsize_orig; i++)
349 free (maze[i]); 336 free (maze[i]);
350 free (maze); 337 free (maze);
351 /* reconnect disjointed spirals */ 338 /* reconnect disjointed spirals */
352 if (RP->map_layout_style == SPIRAL_LAYOUT) 339 if (RP->map_layout_style == LAYOUT_SPIRAL)
353 connect_spirals (RP->Xsize, RP->Ysize, sym, sym_maze); 340 connect_spirals (RP->Xsize, RP->Ysize, sym, sym_maze);
354 /* reconnect disjointed nethackmazes: the routine for 341 /* reconnect disjointed nethackmazes: the routine for
355 spirals will do the trick? */ 342 spirals will do the trick? */
356 if (RP->map_layout_style == ROGUELIKE_LAYOUT) 343 if (RP->map_layout_style == LAYOUT_ROGUELIKE)
357 connect_spirals (RP->Xsize, RP->Ysize, sym, sym_maze); 344 connect_spirals (RP->Xsize, RP->Ysize, sym, sym_maze);
358 345
359 return sym_maze; 346 return sym_maze;
360} 347}
361 348
364 onion layouts, making them possibly centered on any wall. 351 onion layouts, making them possibly centered on any wall.
365 It'll modify Xsize and Ysize if they're swapped. 352 It'll modify Xsize and Ysize if they're swapped.
366*/ 353*/
367 354
368char ** 355char **
369rotate_layout (char **maze, int rotation, RMParms * RP) 356rotate_layout (char **maze, int rotation, random_map_params * RP)
370{ 357{
371 char **new_maze; 358 char **new_maze;
372 int i, j; 359 int i, j;
373 360
374 switch (rotation) 361 switch (rotation)
375 { 362 {
376 case 0: 363 case 0:
364 return maze;
365 break;
366 case 2: /* a reflection */
367 {
368 char *newmaze = (char *) malloc (sizeof (char) * RP->Xsize * RP->Ysize);
369
370 for (i = 0; i < RP->Xsize; i++)
371 { /* make a copy */
372 for (j = 0; j < RP->Ysize; j++)
373 {
374 newmaze[i * RP->Ysize + j] = maze[i][j];
375 }
376 }
377 for (i = 0; i < RP->Xsize; i++)
378 { /* copy a reflection back */
379 for (j = 0; j < RP->Ysize; j++)
380 {
381 maze[i][j] = newmaze[(RP->Xsize - i - 1) * RP->Ysize + RP->Ysize - j - 1];
382 }
383 }
384 free (newmaze);
377 return maze; 385 return maze;
378 break; 386 break;
379 case 2: /* a reflection */ 387 }
388 case 1:
389 case 3:
390 {
391 int swap;
392 new_maze = (char **) calloc (sizeof (char *), RP->Ysize);
393 for (i = 0; i < RP->Ysize; i++)
380 { 394 {
381 char *newmaze = (char *) malloc (sizeof (char) * RP->Xsize * RP->Ysize); 395 new_maze[i] = (char *) calloc (sizeof (char), RP->Xsize);
382 396 }
397 if (rotation == 1) /* swap x and y */
383 for (i = 0; i < RP->Xsize; i++) 398 for (i = 0; i < RP->Xsize; i++)
384 { /* make a copy */
385 for (j = 0; j < RP->Ysize; j++) 399 for (j = 0; j < RP->Ysize; j++)
386 {
387 newmaze[i * RP->Ysize + j] = maze[i][j]; 400 new_maze[j][i] = maze[i][j];
388 } 401
389 } 402 if (rotation == 3)
390 for (i = 0; i < RP->Xsize; i++) 403 { /* swap x and y */
391 { /* copy a reflection back */
392 for (j = 0; j < RP->Ysize; j++)
393 {
394 maze[i][j] = newmaze[(RP->Xsize - i - 1) * RP->Ysize + RP->Ysize - j - 1];
395 }
396 }
397 free (newmaze);
398 return maze;
399 break;
400 }
401 case 1:
402 case 3:
403 {
404 int swap;
405 new_maze = (char **) calloc (sizeof (char *), RP->Ysize);
406 for (i = 0; i < RP->Ysize; i++)
407 {
408 new_maze[i] = (char *) calloc (sizeof (char), RP->Xsize);
409 }
410 if (rotation == 1) /* swap x and y */
411 for (i = 0; i < RP->Xsize; i++) 404 for (i = 0; i < RP->Xsize; i++)
412 for (j = 0; j < RP->Ysize; j++) 405 for (j = 0; j < RP->Ysize; j++)
413 new_maze[j][i] = maze[i][j];
414
415 if (rotation == 3)
416 { /* swap x and y */
417 for (i = 0; i < RP->Xsize; i++)
418 for (j = 0; j < RP->Ysize; j++)
419 new_maze[j][i] = maze[RP->Xsize - i - 1][RP->Ysize - j - 1]; 406 new_maze[j][i] = maze[RP->Xsize - i - 1][RP->Ysize - j - 1];
420 } 407 }
421 408
422 /* delete the old layout */ 409 /* delete the old layout */
423 for (i = 0; i < RP->Xsize; i++) 410 for (i = 0; i < RP->Xsize; i++)
424 free (maze[i]); 411 free (maze[i]);
425 free (maze); 412 free (maze);
426 413
427 swap = RP->Ysize; 414 swap = RP->Ysize;
428 RP->Ysize = RP->Xsize; 415 RP->Ysize = RP->Xsize;
429 RP->Xsize = swap; 416 RP->Xsize = swap;
430 return new_maze; 417 return new_maze;
431 break; 418 break;
432 } 419 }
433 } 420 }
434 return NULL; 421 return NULL;
435} 422}
436 423
437/* take a layout and make some rooms in it. 424/* take a layout and make some rooms in it.
438 --works best on onions.*/ 425 --works best on onions.*/
439void 426void
440roomify_layout (char **maze, RMParms * RP) 427roomify_layout (char **maze, random_map_params * RP)
441{ 428{
442 int tries = RP->Xsize * RP->Ysize / 30; 429 int tries = RP->Xsize * RP->Ysize / 30;
443 int ti; 430 int ti;
444 431
445 for (ti = 0; ti < tries; ti++) 432 for (ti = 0; ti < tries; ti++)
472/* checks the layout to see if I can stick a horizontal(dir = 0) wall 459/* checks the layout to see if I can stick a horizontal(dir = 0) wall
473 (or vertical, dir == 1) 460 (or vertical, dir == 1)
474 here which ends up on other walls sensibly. */ 461 here which ends up on other walls sensibly. */
475 462
476int 463int
477can_make_wall (char **maze, int dx, int dy, int dir, RMParms * RP) 464can_make_wall (char **maze, int dx, int dy, int dir, random_map_params * RP)
478{ 465{
479 int i1; 466 int i1;
480 int length = 0; 467 int length = 0;
481 468
482 /* dont make walls if we're on the edge. */ 469 /* dont make walls if we're on the edge. */
585} 572}
586 573
587/* puts doors at appropriate locations in a layout. */ 574/* puts doors at appropriate locations in a layout. */
588 575
589void 576void
590doorify_layout (char **maze, RMParms * RP) 577doorify_layout (char **maze, random_map_params * RP)
591{ 578{
592 int ndoors = RP->Xsize * RP->Ysize / 60; /* reasonable number of doors. */ 579 int ndoors = RP->Xsize * RP->Ysize / 60; /* reasonable number of doors. */
593 char *doorlist_x; 580 char *doorlist_x;
594 char *doorlist_y; 581 char *doorlist_y;
595 int doorlocs = 0; /* # of available doorlocations */ 582 int doorlocs = 0; /* # of available doorlocations */
635 free (doorlist_y); 622 free (doorlist_y);
636} 623}
637 624
638 625
639void 626void
640write_map_parameters_to_string (char *buf, RMParms * RP) 627write_map_parameters_to_string (char *buf, random_map_params * RP)
641{ 628{
642
643 char small_buf[256]; 629 char small_buf[256];
644 630
645 sprintf (buf, "xsize %d\nysize %d\n", RP->Xsize, RP->Ysize); 631 sprintf (buf, "xsize %d\nysize %d\n", RP->Xsize, RP->Ysize);
646 632
647 if (RP->wallstyle[0]) 633 if (RP->wallstyle[0])
785 if (RP->origin_y) 771 if (RP->origin_y)
786 { 772 {
787 sprintf (small_buf, "origin_y %d\n", RP->origin_y); 773 sprintf (small_buf, "origin_y %d\n", RP->origin_y);
788 strcat (buf, small_buf); 774 strcat (buf, small_buf);
789 } 775 }
776
790 if (RP->random_seed) 777 if (RP->random_seed)
791 { 778 {
792 /* Add one so that the next map is a bit different */ 779 /* Add one so that the next map is a bit different */
793 sprintf (small_buf, "random_seed %d\n", RP->random_seed + 1); 780 sprintf (small_buf, "random_seed %d\n", RP->random_seed + 1);
794 strcat (buf, small_buf); 781 strcat (buf, small_buf);
797 if (RP->treasureoptions) 784 if (RP->treasureoptions)
798 { 785 {
799 sprintf (small_buf, "treasureoptions %d\n", RP->treasureoptions); 786 sprintf (small_buf, "treasureoptions %d\n", RP->treasureoptions);
800 strcat (buf, small_buf); 787 strcat (buf, small_buf);
801 } 788 }
802
803
804} 789}
805 790
806void 791void
807write_parameters_to_string (char *buf, 792write_parameters_to_string (char *buf,
808 int xsize_n, 793 int xsize_n,
970 if (origin_y_n) 955 if (origin_y_n)
971 { 956 {
972 sprintf (small_buf, "origin_y %d\n", origin_y_n); 957 sprintf (small_buf, "origin_y %d\n", origin_y_n);
973 strcat (buf, small_buf); 958 strcat (buf, small_buf);
974 } 959 }
960
975 if (random_seed_n) 961 if (random_seed_n)
976 { 962 {
977 /* Add one so that the next map is a bit different */ 963 /* Add one so that the next map is a bit different */
978 sprintf (small_buf, "random_seed %d\n", random_seed_n + 1); 964 sprintf (small_buf, "random_seed %d\n", random_seed_n + 1);
979 strcat (buf, small_buf); 965 strcat (buf, small_buf);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines