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

Function pass_one

src/mkmap.c:67–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65};
66
67staticfn void
68pass_one(schar bg_typ, schar fg_typ)
69{
70 coordxy x, y;
71 short count, dr;
72
73 for (x = 2; x <= WIDTH; x++)
74 for (y = 1; y < HEIGHT; y++) {
75 for (count = 0, dr = 0; dr < 8; dr++)
76 if (get_map(x + dirs[dr * 2], y + dirs[(dr * 2) + 1], bg_typ)
77 == fg_typ)
78 count++;
79
80 switch (count) {
81 case 0: /* death */
82 case 1:
83 case 2:
84 levl[x][y].typ = bg_typ;
85 break;
86 case 5:
87 case 6:
88 case 7:
89 case 8:
90 levl[x][y].typ = fg_typ;
91 break;
92 default:
93 break;
94 }
95 }
96}
97
98#define new_loc(i, j) *(gn.new_locations + ((j) * (WIDTH + 1)) + (i))
99

Callers 1

mkmapFunction · 0.85

Calls 1

get_mapFunction · 0.85

Tested by

no test coverage detected