MCPcopy Create free account
hub / github.com/NetHack/NetHack / mkmap

Function mkmap

src/mkmap.c:450–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450void
451mkmap(lev_init *init_lev)
452{
453 schar bg_typ = init_lev->bg, fg_typ = init_lev->fg;
454 boolean smooth = init_lev->smoothed, join = init_lev->joined;
455 xint16 lit = init_lev->lit, walled = init_lev->walled;
456 int i;
457
458 lit = litstate_rnd(lit);
459
460 gn.new_locations = (char *) alloc((WIDTH + 1) * HEIGHT);
461
462 init_map(bg_typ);
463 init_fill(bg_typ, fg_typ);
464
465 for (i = 0; i < N_P1_ITER; i++)
466 pass_one(bg_typ, fg_typ);
467
468 for (i = 0; i < N_P2_ITER; i++)
469 pass_two(bg_typ, fg_typ);
470
471 if (smooth)
472 for (i = 0; i < N_P3_ITER; i++)
473 pass_three(bg_typ, fg_typ);
474
475 if (join)
476 join_map(bg_typ, fg_typ);
477
478 finish_map(fg_typ, bg_typ, (boolean) lit, (boolean) walled,
479 init_lev->icedpools);
480 /* a walled, joined level is cavernous, not mazelike -dlc */
481 if (walled && join) {
482 svl.level.flags.is_maze_lev = FALSE;
483 svl.level.flags.is_cavernous_lev = TRUE;
484 }
485 free(gn.new_locations);
486}
487
488/*mkmap.c*/

Callers 1

splev_initlevFunction · 0.85

Calls 9

litstate_rndFunction · 0.85
init_mapFunction · 0.85
init_fillFunction · 0.85
pass_oneFunction · 0.85
pass_twoFunction · 0.85
pass_threeFunction · 0.85
join_mapFunction · 0.85
finish_mapFunction · 0.85
allocFunction · 0.70

Tested by

no test coverage detected