MCPcopy Index your code
hub / github.com/NetHack/NetHack / clear_level_structures

Function clear_level_structures

src/mklev.c:849–927  ·  view source on GitHub ↗

clear out various globals that keep information on the current level. * some of this is only necessary for some types of levels (maze, normal, * special) but it's easier to put it all in one place than make sure * each type initializes what it needs to separately. */

Source from the content-addressed store, hash-verified

847 * each type initializes what it needs to separately.
848 */
849void
850clear_level_structures(void)
851{
852 static struct rm zerorm = { GLYPH_UNEXPLORED,
853 0, 0, 0, 0, 0, 0, 0, 0, 0 };
854 coordxy x, y;
855 struct rm *lev;
856
857 /* note: normally we'd start at x=1 because map column #0 isn't used
858 (except for placing vault guard at <0,0> when removed from the map
859 but not from the level); explicitly reset column #0 along with the
860 rest so that we start the new level with a completely clean slate */
861 for (x = 0; x < COLNO; x++) {
862 lev = &levl[x][0];
863 for (y = 0; y < ROWNO; y++) {
864 *lev++ = zerorm;
865 svl.level.objects[x][y] = (struct obj *) 0;
866 svl.level.monsters[x][y] = (struct monst *) 0;
867 }
868 }
869 svl.level.objlist = (struct obj *) 0;
870 svl.level.buriedobjlist = (struct obj *) 0;
871 svl.level.monlist = (struct monst *) 0;
872 svl.level.damagelist = (struct damage *) 0;
873 svl.level.bonesinfo = (struct cemetery *) 0;
874
875 svl.level.flags.nfountains = 0;
876 svl.level.flags.nsinks = 0;
877 svl.level.flags.has_shop = 0;
878 svl.level.flags.has_vault = 0;
879 svl.level.flags.has_zoo = 0;
880 svl.level.flags.has_court = 0;
881 svl.level.flags.has_morgue = svl.level.flags.graveyard = 0;
882 svl.level.flags.has_beehive = 0;
883 svl.level.flags.has_barracks = 0;
884 svl.level.flags.has_temple = 0;
885 svl.level.flags.has_swamp = 0;
886 svl.level.flags.noteleport = 0;
887 svl.level.flags.hardfloor = 0;
888 svl.level.flags.nommap = 0;
889 svl.level.flags.hero_memory = 1;
890 svl.level.flags.shortsighted = 0;
891 svl.level.flags.sokoban_rules = 0;
892 svl.level.flags.is_maze_lev = 0;
893 svl.level.flags.is_cavernous_lev = 0;
894 svl.level.flags.arboreal = 0;
895 svl.level.flags.has_town = 0;
896 svl.level.flags.wizard_bones = 0;
897 svl.level.flags.corrmaze = 0;
898 svl.level.flags.temperature = In_hell(&u.uz) ? 1 : 0;
899 svl.level.flags.rndmongen = 1;
900 svl.level.flags.deathdrops = 1;
901 svl.level.flags.noautosearch = 0;
902 svl.level.flags.fumaroles = 0;
903 svl.level.flags.stormy = 0;
904 svl.level.flags.stasis_until = 0L;
905
906 svn.nroom = 0;

Callers 3

makelevelFunction · 0.85
savelev_coreFunction · 0.85
lspo_reset_levelFunction · 0.85

Calls 6

In_hellFunction · 0.85
init_rectFunction · 0.85
stairway_free_allFunction · 0.85
clear_regionsFunction · 0.85
free_exclusionsFunction · 0.85
reset_xystart_sizeFunction · 0.85

Tested by

no test coverage detected