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

Function map_cleanup

src/sp_lev.c:327–356  ·  view source on GitHub ↗

do a post-level-creation cleanup of map, such as removing boulders and traps from lava */

Source from the content-addressed store, hash-verified

325/* do a post-level-creation cleanup of map, such as
326 removing boulders and traps from lava */
327staticfn void
328map_cleanup(void)
329{
330 struct obj *otmp;
331 struct trap *ttmp;
332 struct engr *etmp;
333 coordxy x, y;
334
335 for (x = 0; x < COLNO; x++)
336 for (y = 0; y < ROWNO; y++) {
337 schar typ = levl[x][y].typ;
338
339 if (IS_LAVA(typ) || IS_POOL(typ)) {
340 /* in case any boulders are on liquid, delete them */
341 while ((otmp = sobj_at(BOULDER, x, y)) != 0) {
342 obj_extract_self(otmp);
343 obfree(otmp, (struct obj *) 0);
344 }
345
346 /* traps on liquid? */
347 if (((ttmp = t_at(x, y)) != 0)
348 && !undestroyable_trap(ttmp->ttyp))
349 deltrap(ttmp);
350
351 /* engravings? */
352 if ((etmp = engr_at(x, y)) != 0)
353 del_engr(etmp);
354 }
355 }
356}
357
358staticfn void
359lvlfill_maze_grid(int x1, int y1, int x2, int y2, schar filling)

Callers 2

lspo_finalize_levelFunction · 0.85
load_specialFunction · 0.85

Calls 7

sobj_atFunction · 0.85
obj_extract_selfFunction · 0.85
obfreeFunction · 0.85
t_atFunction · 0.85
deltrapFunction · 0.85
engr_atFunction · 0.85
del_engrFunction · 0.85

Tested by

no test coverage detected