more bot() tinkering

This commit is contained in:
nhmall
2023-11-17 09:47:39 -05:00
parent a46c71f4c5
commit 0a13d759a3
7 changed files with 13 additions and 4 deletions

View File

@@ -245,7 +245,7 @@ do_statusline2(void)
void
bot(void)
{
if (gp.program_state.in_getlin)
if (gb.bot_disabled)
return;
/* dosave() flags completion by setting u.uhp to -1; suppress_map_output()
covers program_state.restoring and is used for status as well as map */
@@ -267,7 +267,7 @@ bot(void)
void
timebot(void)
{
if (gp.program_state.in_getlin)
if (gb.bot_disabled)
return;
/* we're called when iflags.time_botl is set and general gc.context.botl
is clear; iflags.time_botl gets set whenever gm.moves changes value

View File

@@ -248,6 +248,7 @@ const struct instance_globals_b g_init_b = {
FALSE, /* bucx_filter */
/* zap.c */
NULL, /* buzzer -- monst that zapped/cast/breathed to initiate buzz() */
FALSE, /* bot_disabled */
TRUE, /* havestate*/
IVMAGIC /* b_magic to validate that structure layout has been preserved */

View File

@@ -851,6 +851,7 @@ panic VA_DECL(const char *, str)
if (gp.program_state.panicking++)
NH_abort(NULL); /* avoid loops - this should never happen*/
gb.bot_disabled = TRUE;
if (iflags.window_inited) {
raw_print("\r\nOops...");
wait_synch(); /* make sure all pending output gets flushed */

View File

@@ -1682,8 +1682,12 @@ get_menu_coloring(const char *str, int *color, int *attr)
void
getlin(const char *query, register char *bufp)
{
boolean old_bot_disabled = gb.bot_disabled;
gp.program_state.in_getlin = 1;
gb.bot_disabled = TRUE;
(*windowprocs.win_getlin)(query, bufp);
gb.bot_disabled = old_bot_disabled;
gp.program_state.in_getlin = 0;
}
/*windows.c*/