File src/dungeon.c

References Variables: dungeon_topologysrc/decl.c

Included Files


Preprocessor definitions

#define DUNGEON_FILE "dungeon"

#define X_START "x-strt"

#define X_LOCATE "x-loca"

#define X_GOAL "x-goal"

#define branch_val( bp )

#define badspot( x, y )


Type struct proto_dungeon

struct proto_dungeon
struct proto_dungeon 
   { 
     struct tmpdungeon tmpdungeon[16]; 
     struct tmplevel tmplevel[50]; 
     s_level* final_lev[50]; 
     struct tmpbranch tmpbranch[32]; 
     int start; 
     int n_levs; 
     int n_brs; 
   } 

Type struct level_map

struct level_map
struct level_map 
   { 
     const char* lev_name; 
     d_level* lev_spec; 
   } 

Global Variable n_dgns

int n_dgns
Visible in:  src/dungeon.c
  arti_invoke()src/artifact.c
Used in: arti_invoke()src/artifact.c
  deepest_lev_reached()src/dungeon.c
  dname_to_dnum()src/dungeon.c
  init_dungeons()src/dungeon.c
  ledger_to_dnum()src/dungeon.c
  maxledgerno()src/dungeon.c
  print_dungeon()src/dungeon.c
  restore_dungeon()src/dungeon.c
  save_dungeon()src/dungeon.c

Global Variable level_map

struct level_map level_map[]
Visible in:  src/dungeon.c
Used in: init_dungeons()src/dungeon.c

Local Variables

branches
static branch* branches
Used in: Is_branchlev()
  dungeon_branch()
  find_branch()
  get_level()
  init_dungeons()
  insert_branch()
  parent_dlevel()
  print_branch()
  print_dungeon()
  restore_dungeon()
  save_dungeon()

Global Function Can_dig_down()

boolean Can_dig_down ( d_level* lev )
Prototyped in: include/extern.h
Calls: Invocation_lev()src/dungeon.c
  Is_botlevel()src/dungeon.c
Called by: Can_fall_thru()src/dungeon.c
  dig_check()src/dig.c
  digactualhole()src/dig.c
  dighole()src/dig.c
  do_break_wand()src/apply.c
References Variables: levelsrc/decl.c

Global Function Can_fall_thru()

boolean Can_fall_thru ( d_level* lev )
Prototyped in: include/extern.h
Calls: Can_dig_down()src/dungeon.c
  on_level()src/dungeon.c
Called by: dodown()src/do.c
References Variables: dungeon_topologysrc/decl.c

Global Function Can_rise_up()

boolean Can_rise_up ( int x, int y, d_level* lev )
Prototyped in: include/extern.h
Calls: In_W_tower()src/dungeon.c
  ledger_no()src/dungeon.c
  on_level()src/dungeon.c
References Variables: dungeon_topologysrc/decl.c
  dungeonssrc/decl.c
  sstairssrc/decl.c

Global Function In_V_tower()

boolean In_V_tower ( d_level* lev )
Prototyped in: include/extern.h
Called by: goto_level()src/do.c
  lev_by_name()src/dungeon.c
References Variables: dungeon_topologysrc/decl.c

Global Function In_W_tower()

boolean In_W_tower ( int x, int y, d_level* lev )
Prototyped in: include/extern.h
Calls: On_W_tower_level()src/dungeon.c
  impossible()
Called by: Can_rise_up()src/dungeon.c
  goto_level()src/do.c
  migrate_to_level()src/dog.c
References Variables: dndestsrc/decl.c

Global Function In_hell()

boolean In_hell ( d_level* lev )
Prototyped in: include/extern.h
Called by: Invocation_lev()src/dungeon.c
  goto_level()src/do.c
  no_bones_level()src/bones.c
References Variables: dungeonssrc/decl.c

Global Function In_mines()

boolean In_mines ( d_level* lev )
Prototyped in: include/extern.h
References Variables: dungeon_topologysrc/decl.c

Global Function In_quest()

boolean In_quest ( d_level* lev )
Prototyped in: include/extern.h
Called by: describe_level()src/botl.c
  goto_level()src/do.c
References Variables: dungeon_topologysrc/decl.c

Global Function Invocation_lev()

boolean Invocation_lev ( d_level* lev )
Prototyped in: include/extern.h
Calls: In_hell()src/dungeon.c
Called by: Can_dig_down()src/dungeon.c
  print_dungeon()src/dungeon.c
References Variables: dungeonssrc/decl.c

Global Function Is_botlevel()

boolean Is_botlevel ( d_level* lev )
Prototyped in: include/extern.h
Called by: Can_dig_down()src/dungeon.c
  digactualhole()src/dig.c
  drop_to()src/dokick.c
  no_bones_level()src/bones.c
References Variables: dungeonssrc/decl.c

Global Function Is_branchlev()

branch* Is_branchlev ( d_level* lev )
Prototyped in: include/extern.h
Calls: on_level()src/dungeon.c
Called by: can_make_bones()src/bones.c
  no_bones_level()src/bones.c
References Variables: branchessrc/dungeon.c

Global Function Is_special()

s_level* Is_special ( d_level* lev )
Prototyped in: include/extern.h
Calls: on_level()src/dungeon.c
Called by: dokick()src/dokick.c
  induced_align()src/dungeon.c
  no_bones_level()src/bones.c
References Variables: sp_levchnsrc/decl.c

Global Function On_W_tower_level()

boolean On_W_tower_level ( d_level* lev )
Prototyped in: include/extern.h
Calls: on_level()src/dungeon.c
Called by: In_W_tower()src/dungeon.c
  goto_level()src/do.c
References Variables: dungeon_topologysrc/decl.c

Global Function On_stairs()

boolean On_stairs ( xchar x, xchar y )
Prototyped in: include/extern.h
Called by: dig_check()src/dig.c
  use_bell()src/apply.c
  use_trap()src/apply.c
  zap_dig()src/dig.c
References Variables: dnladdersrc/decl.c
  dnstairsrc/decl.c
  sstairssrc/decl.c
  upladdersrc/decl.c
  upstairsrc/decl.c

Global Function assign_level()

void assign_level ( d_level* dest, d_level* src )
Prototyped in: include/extern.h
Called by: deferred_goto()src/do.c
  digactualhole()src/dig.c
  goto_level()src/do.c
  init_dungeons()src/dungeon.c
  no_bones_level()src/bones.c
  schedule_goto()src/do.c
  use_pick_axe()src/dig.c

Global Function assign_rnd_level()

void assign_rnd_level ( d_level* dest, d_level* src, int range )
Prototyped in: include/extern.h
Calls: dunlevs_in_dungeon()src/dungeon.c
  rnd()
Called by: goto_level()src/do.c

Global Function at_dgn_entrance()

boolean at_dgn_entrance ( const char* s )
Prototyped in: include/extern.h
Calls: dungeon_branch()src/dungeon.c
  on_level()src/dungeon.c
Called by: goto_level()src/do.c
References Variables: usrc/decl.c

Global Function deepest_lev_reached()

xchar deepest_lev_reached ( boolean noquest )
Prototyped in: include/extern.h
Calls: depth()src/dungeon.c
  strcmp()
Called by: botl_score()src/botl.c
  level_difficulty()src/dungeon.c
References Variables: dungeonssrc/decl.c
  n_dgnssrc/dungeon.c

Global Function depth()

schar depth ( d_level* lev )
Prototyped in: include/extern.h
Called by: arti_invoke()src/artifact.c
  can_make_bones()src/bones.c
  deepest_lev_reached()src/dungeon.c
  describe_level()src/botl.c
  digactualhole()src/dig.c
  goto_level()src/do.c
  init_dungeons()src/dungeon.c
  lev_by_name()src/dungeon.c
  level_difficulty()src/dungeon.c
  level_distance()src/detect.c
  migrate_to_level()src/dog.c
  moveloop()src/allmain.c
  print_branch()src/dungeon.c
  print_dungeon()src/dungeon.c
References Variables: dungeonssrc/decl.c

Global Function dungeon_branch()

branch* dungeon_branch ( const char* s )
Prototyped in: include/extern.h
Calls: dname_to_dnum()src/dungeon.c
  panic()
Called by: at_dgn_entrance()src/dungeon.c
References Variables: branchessrc/dungeon.c

Global Function dunlev()

xchar dunlev ( d_level* lev )
Prototyped in: include/extern.h
Called by: describe_level()src/botl.c
  dokick()src/dokick.c
  goto_level()src/do.c

Global Function dunlevs_in_dungeon()

xchar dunlevs_in_dungeon ( d_level* lev )
Prototyped in: include/extern.h
Called by: assign_rnd_level()src/dungeon.c
  dokick()src/dokick.c
  goto_level()src/do.c
  init_dungeons()src/dungeon.c
  no_bones_level()src/bones.c
References Variables: dungeonssrc/decl.c

Global Function find_hell()

void find_hell ( d_level* lev )
Prototyped in: include/extern.h
Called by: goto_hell()src/dungeon.c
References Variables: dungeon_topologysrc/decl.c

Global Function find_level()

s_level* find_level ( const char* s )
Prototyped in: include/extern.h
Calls: strncmpi()
Called by: init_dungeons()src/dungeon.c
  lev_by_name()src/dungeon.c
References Variables: sp_levchnsrc/decl.c

Global Function get_level()

void get_level ( d_level* newlevel, int levnum )
Prototyped in: include/extern.h
Calls: panic()
Called by: digactualhole()src/dig.c
References Variables: branchessrc/dungeon.c
  dungeonssrc/decl.c
  usrc/decl.c

Global Function goto_hell()

void goto_hell ( boolean at_stairs, boolean falling )
Prototyped in: include/extern.h
Calls: find_hell()src/dungeon.c
  goto_level()src/do.c
Called by: dodown()src/do.c

Global Function induced_align()

int induced_align ( int pct )
Prototyped in: include/extern.h
Calls: Is_special()src/dungeon.c
  rn2()
References Variables: dungeonssrc/decl.c
  usrc/decl.c

Global Function init_dungeons()

void init_dungeons ( void )
Prototyped in: include/extern.h
Calls: Fread()src/dungeon.c
  add_branch()src/dungeon.c
  add_level()src/dungeon.c
  assign_level()src/dungeon.c
  depth()src/dungeon.c
  dlb_fclose()src/dlb.c
  dlb_fopen()src/dlb.c
  dname_to_dnum()src/dungeon.c
  dunlevs_in_dungeon()src/dungeon.c
  find_level()src/dungeon.c
  init_level()src/dungeon.c
  insert_branch()src/dungeon.c
  on_level()src/dungeon.c
  place_level()src/dungeon.c
  check_version(), panic(), rn2(), sprintf(), strcat(), strcpy(), strncmp()
Called by: newgame()src/allmain.c
References Variables: branchessrc/dungeon.c
  dungeon_topologysrc/decl.c
  dungeonssrc/decl.c
  flagssrc/decl.c
  level_mapsrc/dungeon.c
  n_dgnssrc/dungeon.c
  sp_levchnsrc/decl.c
  tunesrc/decl.c
  urole

Global Function insert_branch()

void insert_branch ( branch* new_branch, boolean extract_first )
Prototyped in: include/extern.h
Calls: panic()
Called by: add_branch()src/dungeon.c
  init_dungeons()src/dungeon.c
References Variables: branchessrc/dungeon.c

Global Function ledger_no()

xchar ledger_no ( d_level* lev )
Prototyped in: include/extern.h
Called by: Can_rise_up()src/dungeon.c
  can_make_bones()src/bones.c
  currentlevel_rewrite()src/do.c
  digactualhole()src/dig.c
  doup()src/do.c
  find_branch()src/dungeon.c
  goto_level()src/do.c
  keepdogs()src/dog.c
  lev_by_name()src/dungeon.c
  no_bones_level()src/bones.c
  save_currentstate()src/do.c
  savebones()src/bones.c
References Variables: dungeonssrc/decl.c

Global Function ledger_to_dlev()

xchar ledger_to_dlev ( xchar ledgerno )
Prototyped in: include/extern.h
Calls: ledger_to_dnum()src/dungeon.c
Called by: lev_by_name()src/dungeon.c
  migrate_to_level()src/dog.c
References Variables: dungeonssrc/decl.c

Global Function ledger_to_dnum()

xchar ledger_to_dnum ( xchar ledgerno )
Prototyped in: include/extern.h
Calls: panic()
Called by: ledger_to_dlev()src/dungeon.c
  lev_by_name()src/dungeon.c
  migrate_to_level()src/dog.c
References Variables: dungeonssrc/decl.c
  n_dgnssrc/dungeon.c

Global Function lev_by_name()

schar lev_by_name ( const char* nam )
Prototyped in: include/extern.h
Calls: In_V_tower()src/dungeon.c
  depth()src/dungeon.c
  find_branch()src/dungeon.c
  find_level()src/dungeon.c
  ledger_no()src/dungeon.c
  ledger_to_dlev()src/dungeon.c
  ledger_to_dnum()src/dungeon.c
  eos(), strcpy(), strncmpi(), strstri()
References Variables: dungeon_topologysrc/decl.c
  flagssrc/decl.c
  level_infosrc/decl.c
  usrc/decl.c

Global Function level_difficulty()

xchar level_difficulty ( void )
Prototyped in: include/extern.h
Calls: deepest_lev_reached()src/dungeon.c
  depth()src/dungeon.c
References Variables: dungeon_topologysrc/decl.c
  usrc/decl.c

Global Function maxledgerno()

xchar maxledgerno ( void )
Prototyped in: include/extern.h
Called by: can_make_bones()src/bones.c
  goto_level()src/do.c
  save_dungeon()src/dungeon.c
References Variables: dungeonssrc/decl.c
  n_dgnssrc/dungeon.c

Global Function next_level()

void next_level ( boolean at_stairs )
Prototyped in: include/extern.h
Calls: goto_level()src/do.c
Called by: dodown()src/do.c
References Variables: sstairssrc/decl.c
  usrc/decl.c

Global Function on_level()

boolean on_level ( d_level* lev1, d_level* lev2 )
Prototyped in: include/extern.h
Called by: Can_fall_thru()src/dungeon.c
  Can_rise_up()src/dungeon.c
  Is_branchlev()src/dungeon.c
  Is_special()src/dungeon.c
  On_W_tower_level()src/dungeon.c
  at_dgn_entrance()src/dungeon.c
  boulder_hits_pool()src/do.c
  cvt_sdoor_to_door()src/detect.c
  deferred_goto()src/do.c
  describe_level()src/botl.c
  destroy_drawbridge()src/dbridge.c
  dig()src/dig.c
  dig_check()src/dig.c
  digactualhole()src/dig.c
  dighole()src/dig.c
  doapply()src/apply.c
  docrt()src/display.c
  dodown()src/do.c
  dokick()src/dokick.c
  down_gate()src/dokick.c
  drop_to()src/dokick.c
  e_survives_at()src/dbridge.c
  enlightenment()src/cmd.c
  feel_location()src/display.c
  goto_level()src/do.c
  init_dungeons()src/dungeon.c
  jump()src/apply.c
  moveloop()src/allmain.c
  newsym()src/display.c
  open_drawbridge()src/dbridge.c
  print_dungeon()src/dungeon.c
  throw_gold()src/dothrow.c
  throwit()src/dothrow.c
  under_water()src/display.c
  use_figurine()src/apply.c
  use_pick_axe()src/dig.c
  use_stethoscope()src/apply.c
  use_whip()src/apply.c
  zap_dig()src/dig.c

Global Function prev_level()

void prev_level ( boolean at_stairs )
Prototyped in: include/extern.h
Calls: goto_level()src/do.c
  done()
Called by: doup()src/do.c
References Variables: sstairssrc/decl.c
  usrc/decl.c

Global Function print_dungeon()

void print_dungeon ( void )
Prototyped in: include/extern.h
Calls: Invocation_lev()src/dungeon.c
  br_string()src/dungeon.c
  depth()src/dungeon.c
  on_level()src/dungeon.c
  print_branch()src/dungeon.c
  eos(), sprintf(), strcat()
Called by: wiz_where()src/cmd.c
References Variables: branchessrc/dungeon.c
  dungeon_topologysrc/decl.c
  dungeonssrc/decl.c
  ftrapsrc/decl.c
  inv_possrc/decl.c
  n_dgnssrc/dungeon.c
  sp_levchnsrc/decl.c
  tunesrc/decl.c
  usrc/decl.c
  windowprocs

Global Function restore_dungeon()

void restore_dungeon ( int fd )
Prototyped in: include/extern.h
Calls: alloc()src/alloc.c
  mread(), panic()
References Variables: branchessrc/dungeon.c
  dungeon_topologysrc/decl.c
  dungeonssrc/decl.c
  inv_possrc/decl.c
  level_infosrc/decl.c
  n_dgnssrc/dungeon.c
  tunesrc/decl.c

Global Function save_dungeon()

void save_dungeon ( int fd, boolean perform_write, boolean free_data )
Prototyped in: include/extern.h
Calls: maxledgerno()src/dungeon.c
  bwrite(), free()
References Variables: branchessrc/dungeon.c
  dungeon_topologysrc/decl.c
  dungeonssrc/decl.c
  inv_possrc/decl.c
  level_infosrc/decl.c
  n_dgnssrc/dungeon.c
  tunesrc/decl.c

Global Function u_on_dnstairs()

void u_on_dnstairs ( void )
Prototyped in: include/extern.h
Calls: u_on_newpos()src/dungeon.c
  u_on_sstairs()src/dungeon.c
Called by: goto_level()src/do.c
References Variables: dnstairsrc/decl.c

Global Function u_on_newpos()

void u_on_newpos ( int x, int y )
Prototyped in: include/extern.h
Called by: goto_level()src/do.c
  u_on_dnstairs()src/dungeon.c
  u_on_sstairs()src/dungeon.c
  u_on_upstairs()src/dungeon.c
References Variables: usrc/decl.c
  windowprocs

Global Function u_on_sstairs()

void u_on_sstairs ( void )
Prototyped in: include/extern.h
Calls: u_on_newpos()src/dungeon.c
  panic(), rn2(), rnd()
Called by: goto_level()src/do.c
  u_on_dnstairs()src/dungeon.c
  u_on_upstairs()src/dungeon.c
References Variables: levelsrc/decl.c
  sstairssrc/decl.c

Global Function u_on_upstairs()

void u_on_upstairs ( void )
Prototyped in: include/extern.h
Calls: u_on_newpos()src/dungeon.c
  u_on_sstairs()src/dungeon.c
Called by: goto_level()src/do.c
  newgame()src/allmain.c
References Variables: upstairsrc/decl.c

Local Function Fread()

static void Fread ( genericptr_t ptr, int size, int nitems, dlb* stream )
Prototyped in: src/dungeon.c
Calls: dlb_fread()src/dlb.c
  panic(), terminate()
Called by: init_dungeons()src/dungeon.c

Local Function add_branch()

static branch* add_branch ( int dgn, int child_entry_level, struct proto_dungeon* pd )
Prototyped in: src/dungeon.c
Calls: alloc()src/alloc.c
  correct_branch_type()src/dungeon.c
  find_branch()src/dungeon.c
  insert_branch()src/dungeon.c
  parent_dlevel()src/dungeon.c
  parent_dnum()src/dungeon.c
Called by: init_dungeons()src/dungeon.c
References Variables: dungeonssrc/decl.c

Local Function add_level()

static void add_level ( s_level* new_lev )
Prototyped in: src/dungeon.c
Called by: init_dungeons()src/dungeon.c
References Variables: sp_levchnsrc/decl.c

Local Function br_string()

static const char* br_string ( int type )
Prototyped in: src/dungeon.c
Called by: print_branch()src/dungeon.c
  print_dungeon()src/dungeon.c

Local Function correct_branch_type()

static int correct_branch_type ( struct tmpbranch* tbr )
Prototyped in: src/dungeon.c
Calls: impossible()
Called by: add_branch()src/dungeon.c

Local Function dname_to_dnum()

static xchar dname_to_dnum ( const char* s )
Prototyped in: src/dungeon.c
Calls: panic(), strcmp()
Called by: dungeon_branch()src/dungeon.c
  init_dungeons()src/dungeon.c
References Variables: dungeonssrc/decl.c
  n_dgnssrc/dungeon.c

Local Function find_branch()

static int find_branch ( const char* s, struct proto_dungeon* pd )
Prototyped in: src/dungeon.c
Calls: ledger_no()src/dungeon.c
  panic(), strcmp(), strncmpi()
Called by: add_branch()src/dungeon.c
  lev_by_name()src/dungeon.c
  parent_dlevel()src/dungeon.c
  parent_dnum()src/dungeon.c
References Variables: branchessrc/dungeon.c
  dungeonssrc/decl.c

Local Function init_level()

static void init_level ( int dgn, int proto_index, struct proto_dungeon* pd )
Prototyped in: src/dungeon.c
Calls: alloc()src/alloc.c
  rn2(), strcpy()
Called by: init_dungeons()src/dungeon.c
References Variables: flagssrc/decl.c

Local Function level_range()

static int level_range ( xchar dgn, int base, int rand, int chain, struct proto_dungeon* pd, int* adjusted_base )
Prototyped in: src/dungeon.c
Calls: panic()
Called by: parent_dlevel()src/dungeon.c
  possible_places()src/dungeon.c
References Variables: dungeonssrc/decl.c

Local Function parent_dlevel()

static xchar parent_dlevel ( const char* s, struct proto_dungeon* pd )
Prototyped in: src/dungeon.c
Calls: find_branch()src/dungeon.c
  level_range()src/dungeon.c
  parent_dnum()src/dungeon.c
  rn2()
Called by: add_branch()src/dungeon.c
References Variables: branchessrc/dungeon.c

Local Function parent_dnum()

static xchar parent_dnum ( const char* s, struct proto_dungeon* pd )
Prototyped in: src/dungeon.c
Calls: find_branch()src/dungeon.c
  panic(), strcmp()
Called by: add_branch()src/dungeon.c
  parent_dlevel()src/dungeon.c

Local Function pick_level()

static xchar pick_level ( boolean* map, int nth )
Prototyped in: src/dungeon.c
Calls: panic()
Called by: place_level()src/dungeon.c

Local Function place_level()

static boolean place_level ( int proto_index, struct proto_dungeon* pd )
Prototyped in: src/dungeon.c
Calls: pick_level()src/dungeon.c
  place_level()src/dungeon.c
  possible_places()src/dungeon.c
  rn2()
Called by: init_dungeons()src/dungeon.c
  place_level()src/dungeon.c

Local Function possible_places()

static int possible_places ( int idx, boolean* map, struct proto_dungeon* pd )
Prototyped in: src/dungeon.c
Calls: level_range()src/dungeon.c
Called by: place_level()src/dungeon.c

Local Function print_branch()

static void print_branch ( winid win, int dnum, int lower_bound, int upper_bound )
Prototyped in: src/dungeon.c
Calls: br_string()src/dungeon.c
  depth()src/dungeon.c
  sprintf()
Called by: print_dungeon()src/dungeon.c
References Variables: branchessrc/dungeon.c
  dungeonssrc/decl.c
  windowprocs