From: cohrs Date: Sun, 24 Feb 2002 18:04:02 +0000 (+0000) Subject: a flag to track if vision is ready X-Git-Tag: MOVE2GIT~3125 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a9beba75e7fce5f2bc48db53669be8faeb94e9c;p=nethack a flag to track if vision is ready - 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. --- diff --git a/include/flag.h b/include/flag.h index 4ce226f61..2c850f30c 100644 --- a/include/flag.h +++ b/include/flag.h @@ -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 */ diff --git a/src/vision.c b/src/vision.c index 09c9b6bc0..1cbac51b6 100644 --- a/src/vision.c +++ b/src/vision.c @@ -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;