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

Function finish_map

src/mkmap.c:330–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330staticfn void
331finish_map(
332 schar fg_typ,
333 schar bg_typ,
334 boolean lit,
335 boolean walled,
336 boolean icedpools)
337{
338 coordxy x, y;
339
340 if (walled)
341 wallify_map(1, 0, COLNO-1, ROWNO-1);
342
343 if (lit) {
344 for (x = 1; x < COLNO; x++)
345 for (y = 0; y < ROWNO; y++)
346 if ((!IS_OBSTRUCTED(fg_typ) && levl[x][y].typ == fg_typ)
347 || (!IS_OBSTRUCTED(bg_typ) && levl[x][y].typ == bg_typ)
348 || (bg_typ == TREE && levl[x][y].typ == bg_typ)
349 || (walled && IS_WALL(levl[x][y].typ)))
350 levl[x][y].lit = TRUE;
351 for (x = 0; x < svn.nroom; x++)
352 svr.rooms[x].rlit = 1;
353 }
354 /* light lava even if everything's otherwise unlit;
355 ice might be frozen pool rather than frozen moat */
356 for (x = 1; x < COLNO; x++)
357 for (y = 0; y < ROWNO; y++) {
358 if (levl[x][y].typ == LAVAPOOL)
359 levl[x][y].lit = TRUE;
360 else if (levl[x][y].typ == ICE)
361 levl[x][y].icedpool = icedpools ? ICED_POOL : ICED_MOAT;
362 }
363}
364
365/*
366 * TODO: If we really want to remove rooms after a map is plopped down

Callers 1

mkmapFunction · 0.85

Calls 1

wallify_mapFunction · 0.85

Tested by

no test coverage detected