/* * Code to fill the dungeon with objects. */ #include "obj.h" #include "vars.h" #include "dice.h" #include "structs.h" #include "objtypes.h" #include "filldungeon.h" /* * Fill the dungeon with objects. At the moment, all we create is * blank maps, one per level of the main dungeon. With the maps * created in the player's inventory, this is enough to map the whole * dungeon. */ void filldungeon(void) { int ln; LEVEL *lv; int x; int y; LOC *lc; for (ln=DUNGEON_LEVELS-1;ln>=0;ln--) { lv = &levels[ln]; do { x = 1 + rnd(LEV_X-2); y = 1 + rnd(LEV_Y-2); lc = &lv->cells[x][y]; } while ( (lc->type != LOC_CAVE) || (lc->cavetype != LOC_JUSTCAVE) || (lc->flags & (LF_SHOP|LF_VAULT)) ); add_obj_to_inv(obj_make(OBJ_MAP),&lc->objs); } }