#ifndef WH_DIGDUNGEON_H_9cc3b734_ #define WH_DIGDUNGEON_H_9cc3b734_ /* * APIs exported by digdungeon.c. These are, of course, things related * to digging the dungeon. */ #include "structs.h" /* * A location to avoid in ckavoid(). See it for more. */ extern LOC *avoidloc; /* * Dig out a cell, given the level it's on and its coordinates. This * also handles converting any ROCKs adjacent to the newly-dug cell to * WALLs. Attempts to dig border cells provoke a panic (WRAPAROUND * levels have no border cells). * * digcell_ is identical except that it silently ignores attempts to * dig border cells. digcell() is suitable for dungeon creation; * digcell_() is suitable for wand of digging. */ extern void digcell(LEVEL *, int, int); extern void digcell_(LEVEL *, int, int); /* * Clear a level. This sets all LOCs on the level to have the type * passed as a second argument, which must be LOC_ROCK or LOC_CAVE; if * LOC_CAVE, the cavetype is set to LOC_JUSTCAVE. All cells also have * their flags and inventory cleared and are set to have no monster. * The link-to link (for gates and stairs) is also cleared and the * on-level backpointers set to point to the level. */ extern void clearlevel(LEVEL *, LOCTYPE); /* * Given a rectangle described as a size-and-position (size sx,sy and * position px,py) on a level l, solidrock(l,sx,sy,px,py) returns true * iff all cells in the rectangle are of type LOC_ROCK. */ extern int solidrock(LEVEL *, int, int, int, int); /* * Clears out certain things for the whole dungeon. For every level, * this initializes the level's monster count to 0 and its cave-cell * count to the actual LOC_CAVE cell count. It also sets the subtype * of any walls and secret doors to "wall of unknown orientation" and * clears all non-permanent flag bits on each LOC. */ extern void cleardungeon(void); /* * Top-level routine for digging the dungeon. This sets up all levels * and digs the dungeon. It does not populate the dungeon with * anything (neither monsters nor objects), just the permanent * features like stairs, doors, and gates. */ extern void digdungeon(void); /* * Location test function which returns true for any CAVE/JUSCTAVE cell * which is neither SHOP nor VAULT. */ extern int ckroutine(LOC *); /* * Location test function which returns true for any CAVE/JUSCTAVE cell * which is neither SHOP nor VAULT and which is at least 20 away in * the L1 (city-block) metric from avoidloc. */ extern int ckavoid(LOC *); /* * Find a random location on a level satisfying a predicate. See the * full description in the comment in digdungeon.c. */ extern LOC *randomloc(LEVEL *, int (*)(LOC *)); /* * Do something for all immediate neighbours of a location, that is, * for a 3x3 square centred on the location. */ extern void all_neighbours(LOC *, void (*)(LOC *)); /* * Flood-fill the region of the dungeon connected to a specific cell. * * flagregion(lev,x,y,updn) fills the region of the dungeon connected * to cell [x][y] on lev. Each cell has LF_FLAG set on it. If updn * is zero, the filling is restricted to lev; if not, it follows * stairs to potentially fill other levels too. Cells that already * have LF_FLAG set, if any such are encountered, will act as boundary * cells. */ extern void flagregion(LEVEL *, int, int, int); #endif