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

Function pass_three

src/mkmap.c:123–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123staticfn void
124pass_three(schar bg_typ, schar fg_typ)
125{
126 coordxy x, y;
127 short count, dr;
128
129 for (x = 2; x <= WIDTH; x++)
130 for (y = 1; y < HEIGHT; y++) {
131 for (count = 0, dr = 0; dr < 8; dr++)
132 if (get_map(x + dirs[dr * 2], y + dirs[(dr * 2) + 1], bg_typ)
133 == fg_typ)
134 count++;
135 if (count < 3)
136 new_loc(x, y) = bg_typ;
137 else
138 new_loc(x, y) = get_map(x, y, bg_typ);
139 }
140
141 for (x = 2; x <= WIDTH; x++)
142 for (y = 1; y < HEIGHT; y++)
143 levl[x][y].typ = new_loc(x, y);
144}
145
146/*
147 * use a flooding algorithm to find all locations that should

Callers 1

mkmapFunction · 0.85

Calls 1

get_mapFunction · 0.85

Tested by

no test coverage detected