]> granicus.if.org Git - nethack/commitdiff
a flag to track if vision is ready
authorcohrs <cohrs>
Sun, 24 Feb 2002 18:04:02 +0000 (18:04 +0000)
committercohrs <cohrs>
Sun, 24 Feb 2002 18:04:02 +0000 (18:04 +0000)
- new iflags.vision_inited to determine if vision is ready to go.
- the flag is set the first time vision_reset() completes, actually every time
- vision_recalc() checks the flag before doing anything.

include/flag.h
src/vision.c

index 4ce226f6103bdac8ab1d419c92f50af7198715fd..2c850f30c98191ff284abb91e73322658aa7673a 100644 (file)
@@ -163,6 +163,7 @@ struct instance_flags {
        boolean  num_pad;       /* use numbers for movement commands */
        boolean  news;          /* print news */
        boolean  window_inited; /* true if init_nhwindows() completed */
+       boolean  vision_inited; /* true if vision is ready */
        boolean  menu_tab_sep;  /* Use tabs to separate option menu fields */
        int      purge_monsters;        /* # of dead monsters still on fmon list */
        int *opt_booldup;       /* for duplication of boolean opts in config file */
index 09c9b6bc0700415c3e280b6da341e00cb1c27da9..1cbac51b66a7a20e07b15372f31ebb31d93005ad 100644 (file)
@@ -242,6 +242,7 @@ vision_reset()
        }
     }
 
+    iflags.vision_inited = 1;  /* vision is ready */
     vision_full_recalc = 1;    /* we want to run vision_recalc() */
 }
 
@@ -510,7 +511,7 @@ vision_recalc(control)
     int oldseenv;                              /* previous seenv value */
 
     vision_full_recalc = 0;                    /* reset flag */
-    if (in_mklev) return;
+    if (in_mklev || !iflags.vision_inited) return;
 
 #ifdef GCC_WARN
     row = 0;
@@ -794,12 +795,13 @@ not_in_sight:
     colbump[u.ux] = colbump[u.ux+1] = 0;
 
 skip:
-    /* This newsym() caused a crash delivering msg about failure to open dungeon file
-     * init_dungeons() -> panic() -> done(11) -> vision_recalc(2) -> newsym() -> crash!
-     * u.ux and u.uy are 0 and program_state.panicking == 1 under those circumstances
+    /* This newsym() caused a crash delivering msg about failure to open
+     * dungeon file init_dungeons() -> panic() -> done(11) ->
+     * vision_recalc(2) -> newsym() -> crash!  u.ux and u.uy are 0 and
+     * program_state.panicking == 1 under those circumstances
      */
     if (!program_state.panicking)
-               newsym(u.ux,u.uy);              /* Make sure the hero shows up! */
+       newsym(u.ux,u.uy);              /* Make sure the hero shows up! */
 
     /* Set the new min and max pointers. */
     viz_rmin  = next_rmin;