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