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

Function lvlfill_swamp

src/sp_lev.c:390–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

388}
389
390staticfn void
391lvlfill_swamp(schar fg, schar bg, schar lit)
392{
393 int x, y;
394
395 lvlfill_solid(bg, lit);
396
397 /* "relaxed blockwise maze" algorithm, Jamis Buck */
398 for (x = 2; x <= min(gx.x_maze_max, COLNO-2); x += 2)
399 for (y = 0; y <= min(gy.y_maze_max, ROWNO-2); y += 2) {
400 int c = 0;
401
402 (void) set_levltyp_lit(x, y, fg, lit);
403 if (levl[x + 1][y].typ == bg)
404 ++c;
405 if (levl[x][y + 1].typ == bg)
406 ++c;
407 if (levl[x + 1][y + 1].typ == bg)
408 ++c;
409 if (c == 3) {
410 switch (rn2(3)) {
411 case 0:
412 (void) set_levltyp_lit(x + 1,y, fg, lit);
413 break;
414 case 1:
415 (void) set_levltyp_lit(x, y + 1, fg, lit);
416 break;
417 case 2:
418 (void) set_levltyp_lit(x + 1, y + 1, fg, lit);
419 break;
420 default:
421 break;
422 }
423 }
424 }
425}
426
427staticfn void
428flip_dbridge_horizontal(struct rm *lev)

Callers 1

splev_initlevFunction · 0.85

Calls 3

lvlfill_solidFunction · 0.85
set_levltyp_litFunction · 0.85
rn2Function · 0.85

Tested by

no test coverage detected