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

Function wallify_map

src/sp_lev.c:2864–2891  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2862}
2863
2864void
2865wallify_map(coordxy x1, coordxy y1, coordxy x2, coordxy y2)
2866{
2867 coordxy x, y, xx, yy, lo_xx, lo_yy, hi_xx, hi_yy;
2868
2869 y1 = max(y1, 0);
2870 x1 = max(x1, 1);
2871 y2 = min(y2, ROWNO - 1);
2872 x2 = min(x2, COLNO - 1);
2873 for (y = y1; y <= y2; y++) {
2874 lo_yy = (y > 0) ? y - 1 : 0;
2875 hi_yy = (y < y2) ? y + 1 : y2;
2876 for (x = x1; x <= x2; x++) {
2877 if (levl[x][y].typ != STONE)
2878 continue;
2879 lo_xx = (x > 1) ? x - 1 : 1;
2880 hi_xx = (x < x2) ? x + 1 : x2;
2881 for (yy = lo_yy; yy <= hi_yy; yy++)
2882 for (xx = lo_xx; xx <= hi_xx; xx++)
2883 if (IS_ROOM(levl[xx][yy].typ)
2884 || levl[xx][yy].typ == CROSSWALL) {
2885 levl[x][y].typ = (yy != y) ? HWALL : VWALL;
2886 yy = hi_yy; /* end `yy' loop */
2887 break; /* end `xx' loop */
2888 }
2889 }
2890 }
2891}
2892
2893/*
2894 * Select a random coordinate in the maze.

Callers 3

finish_mapFunction · 0.85
sel_set_wallifyFunction · 0.85
lspo_wallifyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected