follow-up, program_state
This commit is contained in:
+1
-1
@@ -1194,7 +1194,6 @@ struct instance_globals_saved_p {
|
|||||||
char plname[PL_NSIZ]; /* player name */
|
char plname[PL_NSIZ]; /* player name */
|
||||||
char pl_character[PL_CSIZ];
|
char pl_character[PL_CSIZ];
|
||||||
char pl_fruit[PL_FSIZ];
|
char pl_fruit[PL_FSIZ];
|
||||||
struct sinfo program_state; /* flags describing game's current state */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct instance_globals_saved_q {
|
struct instance_globals_saved_q {
|
||||||
@@ -1280,6 +1279,7 @@ extern struct instance_globals_saved_t svt;
|
|||||||
extern struct instance_globals_saved_u svu;
|
extern struct instance_globals_saved_u svu;
|
||||||
extern struct instance_globals_saved_x svx;
|
extern struct instance_globals_saved_x svx;
|
||||||
extern struct instance_globals_saved_y svy;
|
extern struct instance_globals_saved_y svy;
|
||||||
|
extern struct sinfo program_state; /* flags describing game's current state */
|
||||||
|
|
||||||
struct const_globals {
|
struct const_globals {
|
||||||
const struct obj zeroobj; /* used to zero out a struct obj */
|
const struct obj zeroobj; /* used to zero out a struct obj */
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ mswin_have_input()
|
|||||||
return
|
return
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
/* we always have input (ESC) if hangup was requested */
|
/* we always have input (ESC) if hangup was requested */
|
||||||
svp.program_state.done_hup ||
|
program_state.done_hup ||
|
||||||
#endif
|
#endif
|
||||||
(nhi_read_pos != nhi_write_pos);
|
(nhi_read_pos != nhi_write_pos);
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ mswin_input_pop()
|
|||||||
|
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
/* always return ESC when hangup was requested */
|
/* always return ESC when hangup was requested */
|
||||||
if (svp.program_state.done_hup) {
|
if (program_state.done_hup) {
|
||||||
static MSNHEvent hangup_event;
|
static MSNHEvent hangup_event;
|
||||||
hangup_event.type = NHEVENT_CHAR;
|
hangup_event.type = NHEVENT_CHAR;
|
||||||
hangup_event.kbd.ch = '\033';
|
hangup_event.kbd.ch = '\033';
|
||||||
@@ -98,7 +98,7 @@ mswin_input_peek()
|
|||||||
|
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
/* always return ESC when hangup was requested */
|
/* always return ESC when hangup was requested */
|
||||||
if (svp.program_state.done_hup) {
|
if (program_state.done_hup) {
|
||||||
static MSNHEvent hangup_event;
|
static MSNHEvent hangup_event;
|
||||||
hangup_event.type = NHEVENT_CHAR;
|
hangup_event.type = NHEVENT_CHAR;
|
||||||
hangup_event.kbd.ch = '\033';
|
hangup_event.kbd.ch = '\033';
|
||||||
|
|||||||
@@ -533,7 +533,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
if (!data->text.text) {
|
if (!data->text.text) {
|
||||||
data->text.text = mswin_init_text_buffer(
|
data->text.text = mswin_init_text_buffer(
|
||||||
svp.program_state.gameover ? FALSE : GetNHApp()->bWrapText);
|
program_state.gameover ? FALSE : GetNHApp()->bWrapText);
|
||||||
if (!data->text.text)
|
if (!data->text.text)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ mswin_init_text_window()
|
|||||||
|
|
||||||
ZeroMemory(data, sizeof(NHTextWindow));
|
ZeroMemory(data, sizeof(NHTextWindow));
|
||||||
data->window_text = mswin_init_text_buffer(
|
data->window_text = mswin_init_text_buffer(
|
||||||
svp.program_state.gameover ? FALSE : GetNHApp()->bWrapText);
|
program_state.gameover ? FALSE : GetNHApp()->bWrapText);
|
||||||
SetWindowLong(ret, GWL_USERDATA, (LONG) data);
|
SetWindowLong(ret, GWL_USERDATA, (LONG) data);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4037,7 +4037,7 @@ void NetHackQtMainWindow::keyPressEvent(QKeyEvent* event)
|
|||||||
|
|
||||||
void NetHackQtMainWindow::closeEvent(QCloseEvent* e)
|
void NetHackQtMainWindow::closeEvent(QCloseEvent* e)
|
||||||
{
|
{
|
||||||
if ( svp.program_state.something_worth_saving ) {
|
if ( program_state.something_worth_saving ) {
|
||||||
switch ( QMessageBox::information( this, "NetHack",
|
switch ( QMessageBox::information( this, "NetHack",
|
||||||
"This will end your NetHack session",
|
"This will end your NetHack session",
|
||||||
"&Save", "&Cancel", 0, 1 ) )
|
"&Save", "&Cancel", 0, 1 ) )
|
||||||
@@ -4849,7 +4849,7 @@ void NetHackQtBind::qt_update_inventory()
|
|||||||
if (main)
|
if (main)
|
||||||
main->updateInventory();
|
main->updateInventory();
|
||||||
/* doesn't work yet
|
/* doesn't work yet
|
||||||
if (svp.program_state.something_worth_saving && iflags.perm_invent)
|
if (program_state.something_worth_saving && iflags.perm_invent)
|
||||||
display_inventory(NULL, FALSE);
|
display_inventory(NULL, FALSE);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@@ -4903,14 +4903,14 @@ int NetHackQtBind::qt_nhgetch()
|
|||||||
//
|
//
|
||||||
while (keybuffer.Empty()
|
while (keybuffer.Empty()
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
&& !svp.program_state.done_hup
|
&& !program_state.done_hup
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
qApp->enter_loop();
|
qApp->enter_loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
if (svp.program_state.done_hup && keybuffer.Empty()) return '\033';
|
if (program_state.done_hup && keybuffer.Empty()) return '\033';
|
||||||
#endif
|
#endif
|
||||||
return keybuffer.GetAscii();
|
return keybuffer.GetAscii();
|
||||||
}
|
}
|
||||||
@@ -4924,13 +4924,13 @@ int NetHackQtBind::qt_nh_poskey(int *x, int *y, int *mod)
|
|||||||
//
|
//
|
||||||
while (keybuffer.Empty() && clickbuffer.Empty()
|
while (keybuffer.Empty() && clickbuffer.Empty()
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
&& !svp.program_state.done_hup
|
&& !program_state.done_hup
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
qApp->enter_loop();
|
qApp->enter_loop();
|
||||||
}
|
}
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
if (svp.program_state.done_hup && keybuffer.Empty()) return '\033';
|
if (program_state.done_hup && keybuffer.Empty()) return '\033';
|
||||||
#endif
|
#endif
|
||||||
if (!keybuffer.Empty()) {
|
if (!keybuffer.Empty()) {
|
||||||
return keybuffer.GetAscii();
|
return keybuffer.GetAscii();
|
||||||
@@ -5179,7 +5179,7 @@ bool NetHackQtBind::notify(QObject *receiver, QEvent *event)
|
|||||||
|
|
||||||
bool result=QApplication::notify(receiver,event);
|
bool result=QApplication::notify(receiver,event);
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
if (svp.program_state.done_hup) {
|
if (program_state.done_hup) {
|
||||||
keybuffer.Put('\033');
|
keybuffer.Put('\033');
|
||||||
qApp->exit_loop();
|
qApp->exit_loop();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
@@ -907,7 +907,7 @@ gnome_nhgetch()
|
|||||||
g_askingQuestion = 1;
|
g_askingQuestion = 1;
|
||||||
/* Process events until a key press event arrives. */
|
/* Process events until a key press event arrives. */
|
||||||
while (g_numKeys == 0) {
|
while (g_numKeys == 0) {
|
||||||
if (svp.program_state.done_hup)
|
if (program_state.done_hup)
|
||||||
return '\033';
|
return '\033';
|
||||||
gtk_main_iteration();
|
gtk_main_iteration();
|
||||||
}
|
}
|
||||||
@@ -945,7 +945,7 @@ gnome_nh_poskey(int *x, int *y, int *mod)
|
|||||||
g_askingQuestion = 0;
|
g_askingQuestion = 0;
|
||||||
/* Process events until a key or map-click arrives. */
|
/* Process events until a key or map-click arrives. */
|
||||||
while (g_numKeys == 0 && g_numClicks == 0) {
|
while (g_numKeys == 0 && g_numClicks == 0) {
|
||||||
if (svp.program_state.done_hup)
|
if (program_state.done_hup)
|
||||||
return '\033';
|
return '\033';
|
||||||
gtk_main_iteration();
|
gtk_main_iteration();
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -71,7 +71,7 @@ moveloop_preamble(boolean resuming)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!resuming) { /* new game */
|
if (!resuming) { /* new game */
|
||||||
svp.program_state.beyond_savefile_load = 1; /* for TTY_PERM_INVENT */
|
program_state.beyond_savefile_load = 1; /* for TTY_PERM_INVENT */
|
||||||
svc.context.rndencode = rnd(9000);
|
svc.context.rndencode = rnd(9000);
|
||||||
set_wear((struct obj *) 0); /* for side-effects of starting gear */
|
set_wear((struct obj *) 0); /* for side-effects of starting gear */
|
||||||
reset_justpicked(gi.invent);
|
reset_justpicked(gi.invent);
|
||||||
@@ -100,7 +100,7 @@ moveloop_preamble(boolean resuming)
|
|||||||
u.uz0.dlevel = u.uz.dlevel;
|
u.uz0.dlevel = u.uz.dlevel;
|
||||||
svc.context.move = 0;
|
svc.context.move = 0;
|
||||||
|
|
||||||
svp.program_state.in_moveloop = 1;
|
program_state.in_moveloop = 1;
|
||||||
/* for perm_invent preset at startup, display persistent inventory after
|
/* for perm_invent preset at startup, display persistent inventory after
|
||||||
invent is fully populated and the in_moveloop flag has been set */
|
invent is fully populated and the in_moveloop flag has been set */
|
||||||
if (iflags.perm_invent)
|
if (iflags.perm_invent)
|
||||||
@@ -166,7 +166,7 @@ moveloop_core(void)
|
|||||||
boolean monscanmove = FALSE;
|
boolean monscanmove = FALSE;
|
||||||
|
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
if (svp.program_state.done_hup)
|
if (program_state.done_hup)
|
||||||
end_of_input();
|
end_of_input();
|
||||||
#endif
|
#endif
|
||||||
get_nh_event();
|
get_nh_event();
|
||||||
@@ -781,7 +781,7 @@ newgame(void)
|
|||||||
#ifdef INSURANCE
|
#ifdef INSURANCE
|
||||||
save_currentstate();
|
save_currentstate();
|
||||||
#endif
|
#endif
|
||||||
svp.program_state.something_worth_saving++; /* useful data now exists */
|
program_state.something_worth_saving++; /* useful data now exists */
|
||||||
|
|
||||||
/* Success! */
|
/* Success! */
|
||||||
welcome(TRUE);
|
welcome(TRUE);
|
||||||
|
|||||||
+1
-1
@@ -705,7 +705,7 @@ set_artifact_intrinsic(struct obj *otmp, boolean on, long wp_mask)
|
|||||||
* when restoring a game
|
* when restoring a game
|
||||||
*/
|
*/
|
||||||
(void) make_hallucinated((long) !on,
|
(void) make_hallucinated((long) !on,
|
||||||
svp.program_state.restoring ? FALSE : TRUE,
|
program_state.restoring ? FALSE : TRUE,
|
||||||
wp_mask);
|
wp_mask);
|
||||||
}
|
}
|
||||||
if (spfx & SPFX_ESP) {
|
if (spfx & SPFX_ESP) {
|
||||||
|
|||||||
+1
-1
@@ -191,7 +191,7 @@ adjattrib(
|
|||||||
disp.botl = TRUE;
|
disp.botl = TRUE;
|
||||||
if (msgflg <= 0)
|
if (msgflg <= 0)
|
||||||
You_feel("%s%s!", (incr > 1 || incr < -1) ? "very " : "", attrstr);
|
You_feel("%s%s!", (incr > 1 || incr < -1) ? "very " : "", attrstr);
|
||||||
if (svp.program_state.in_moveloop && (ndx == A_STR || ndx == A_CON))
|
if (program_state.in_moveloop && (ndx == A_STR || ndx == A_CON))
|
||||||
(void) encumber_msg();
|
(void) encumber_msg();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3294,7 +3294,7 @@ rhack(int key)
|
|||||||
svc.context.nopick = 0;
|
svc.context.nopick = 0;
|
||||||
got_prefix_input:
|
got_prefix_input:
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
if (svp.program_state.done_hup)
|
if (program_state.done_hup)
|
||||||
end_of_input();
|
end_of_input();
|
||||||
#endif
|
#endif
|
||||||
if ((cmdq = cmdq_pop()) != 0) {
|
if ((cmdq = cmdq_pop()) != 0) {
|
||||||
@@ -3634,7 +3634,7 @@ getdir(const char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
svp.program_state.input_state = getdirInp;
|
program_state.input_state = getdirInp;
|
||||||
if (gi.in_doagain || *readchar_queue)
|
if (gi.in_doagain || *readchar_queue)
|
||||||
dirsym = readchar();
|
dirsym = readchar();
|
||||||
else
|
else
|
||||||
@@ -4648,7 +4648,7 @@ get_count(
|
|||||||
unsigned gc_flags) /* control flags: GC_SAVEHIST, GC_ECHOFIRST */
|
unsigned gc_flags) /* control flags: GC_SAVEHIST, GC_ECHOFIRST */
|
||||||
{
|
{
|
||||||
char qbuf[QBUFSZ];
|
char qbuf[QBUFSZ];
|
||||||
int key, save_input_state = svp.program_state.input_state;
|
int key, save_input_state = program_state.input_state;
|
||||||
long cnt = 0L, first = inkey ? (long) (inkey - '0') : 0L;
|
long cnt = 0L, first = inkey ? (long) (inkey - '0') : 0L;
|
||||||
boolean backspaced = FALSE, showzero = TRUE,
|
boolean backspaced = FALSE, showzero = TRUE,
|
||||||
/* should "Count: 123" go into message history? */
|
/* should "Count: 123" go into message history? */
|
||||||
@@ -4670,7 +4670,7 @@ get_count(
|
|||||||
} else {
|
} else {
|
||||||
/* if readchar() has already been called in this loop, it will
|
/* if readchar() has already been called in this loop, it will
|
||||||
have reset input_state; put that back to its previous value */
|
have reset input_state; put that back to its previous value */
|
||||||
svp.program_state.input_state = save_input_state;
|
program_state.input_state = save_input_state;
|
||||||
key = readchar();
|
key = readchar();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4737,7 +4737,7 @@ parse(void)
|
|||||||
|
|
||||||
/* affects readchar() behavior for ESC iff 'altmeta' option is On;
|
/* affects readchar() behavior for ESC iff 'altmeta' option is On;
|
||||||
is always reset to otherInp by readchar() */
|
is always reset to otherInp by readchar() */
|
||||||
svp.program_state.input_state = commandInp;
|
program_state.input_state = commandInp;
|
||||||
|
|
||||||
if (!gc.Cmd.num_pad || (foo = readchar()) == gc.Cmd.spkeys[NHKF_COUNT]) {
|
if (!gc.Cmd.num_pad || (foo = readchar()) == gc.Cmd.spkeys[NHKF_COUNT]) {
|
||||||
/* if 'num_pad' is On then readchar() has just reset input_state;
|
/* if 'num_pad' is On then readchar() has just reset input_state;
|
||||||
@@ -4745,7 +4745,7 @@ parse(void)
|
|||||||
otherwise "n<count>ESC<character>" becomes "n<count>ESC" (with
|
otherwise "n<count>ESC<character>" becomes "n<count>ESC" (with
|
||||||
<character> not read from keyboard yet) rather than intended count
|
<character> not read from keyboard yet) rather than intended count
|
||||||
and meta keystroke "n<count>M-<character>" */
|
and meta keystroke "n<count>M-<character>" */
|
||||||
svp.program_state.input_state = commandInp;
|
program_state.input_state = commandInp;
|
||||||
|
|
||||||
foo = get_count((char *) 0, '\0', LARGEST_INT,
|
foo = get_count((char *) 0, '\0', LARGEST_INT,
|
||||||
&gc.command_count, GC_NOFLAGS);
|
&gc.command_count, GC_NOFLAGS);
|
||||||
@@ -4791,8 +4791,8 @@ hangup(
|
|||||||
int sig_unused UNUSED) /* called as signal() handler, so sent
|
int sig_unused UNUSED) /* called as signal() handler, so sent
|
||||||
* at least one arg */
|
* at least one arg */
|
||||||
{
|
{
|
||||||
if (svp.program_state.exiting)
|
if (program_state.exiting)
|
||||||
svp.program_state.in_moveloop = 0;
|
program_state.in_moveloop = 0;
|
||||||
nhwindows_hangup();
|
nhwindows_hangup();
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
/* When using SAFERHANGUP, the done_hup flag is tested in rhack
|
/* When using SAFERHANGUP, the done_hup flag is tested in rhack
|
||||||
@@ -4801,10 +4801,10 @@ hangup(
|
|||||||
protects against losing objects in the process of being thrown,
|
protects against losing objects in the process of being thrown,
|
||||||
but also potentially riskier because the disconnected program
|
but also potentially riskier because the disconnected program
|
||||||
must continue running longer before attempting a hangup save. */
|
must continue running longer before attempting a hangup save. */
|
||||||
svp.program_state.done_hup++;
|
program_state.done_hup++;
|
||||||
/* defer hangup iff game appears to be in progress */
|
/* defer hangup iff game appears to be in progress */
|
||||||
if (svp.program_state.in_moveloop
|
if (program_state.in_moveloop
|
||||||
&& svp.program_state.something_worth_saving)
|
&& program_state.something_worth_saving)
|
||||||
return;
|
return;
|
||||||
#endif /* SAFERHANGUP */
|
#endif /* SAFERHANGUP */
|
||||||
end_of_input();
|
end_of_input();
|
||||||
@@ -4815,16 +4815,16 @@ end_of_input(void)
|
|||||||
{
|
{
|
||||||
#ifdef NOSAVEONHANGUP
|
#ifdef NOSAVEONHANGUP
|
||||||
#ifdef INSURANCE
|
#ifdef INSURANCE
|
||||||
if (flags.ins_chkpt && svp.program_state.something_worth_saving)
|
if (flags.ins_chkpt && program_state.something_worth_saving)
|
||||||
program_state.preserve_locks = 1; /* keep files for recovery */
|
program_state.preserve_locks = 1; /* keep files for recovery */
|
||||||
#endif
|
#endif
|
||||||
svp.program_state.something_worth_saving = 0; /* don't save */
|
program_state.something_worth_saving = 0; /* don't save */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SAFERHANGUP
|
#ifndef SAFERHANGUP
|
||||||
if (!svp.program_state.done_hup++)
|
if (!program_state.done_hup++)
|
||||||
#endif
|
#endif
|
||||||
if (svp.program_state.something_worth_saving)
|
if (program_state.something_worth_saving)
|
||||||
(void) dosave0();
|
(void) dosave0();
|
||||||
if (soundprocs.sound_exit_nhsound)
|
if (soundprocs.sound_exit_nhsound)
|
||||||
(*soundprocs.sound_exit_nhsound)("end_of_input");
|
(*soundprocs.sound_exit_nhsound)("end_of_input");
|
||||||
@@ -4875,7 +4875,7 @@ readchar_core(coordxy *x, coordxy *y, int *mod)
|
|||||||
sym = '\033';
|
sym = '\033';
|
||||||
#ifdef ALTMETA
|
#ifdef ALTMETA
|
||||||
} else if (sym == '\033' && iflags.altmeta
|
} else if (sym == '\033' && iflags.altmeta
|
||||||
&& svp.program_state.input_state != otherInp) {
|
&& program_state.input_state != otherInp) {
|
||||||
/* iflags.altmeta: treat two character ``ESC c'' as single `M-c' but
|
/* iflags.altmeta: treat two character ``ESC c'' as single `M-c' but
|
||||||
only when we're called by parse() [possibly via get_count()]
|
only when we're called by parse() [possibly via get_count()]
|
||||||
or getpos() [to support Alt+digit] or getdir() [for arrow keys
|
or getpos() [to support Alt+digit] or getdir() [for arrow keys
|
||||||
@@ -4895,7 +4895,7 @@ readchar_core(coordxy *x, coordxy *y, int *mod)
|
|||||||
readchar_done:
|
readchar_done:
|
||||||
/* next readchar() will be for an ordinary char unless parse()
|
/* next readchar() will be for an ordinary char unless parse()
|
||||||
sets this back to non-zero */
|
sets this back to non-zero */
|
||||||
svp.program_state.input_state = otherInp;
|
program_state.input_state = otherInp;
|
||||||
return (char) sym;
|
return (char) sym;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4917,7 +4917,7 @@ readchar_poskey(coordxy *x, coordxy *y, int *mod)
|
|||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
svp.program_state.input_state = getposInp;
|
program_state.input_state = getposInp;
|
||||||
ch = readchar_core(x, y, mod);
|
ch = readchar_core(x, y, mod);
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
@@ -5171,7 +5171,7 @@ yn_function(
|
|||||||
res = altres;
|
res = altres;
|
||||||
}
|
}
|
||||||
/* in case we're called via getdir() which sets input_state */
|
/* in case we're called via getdir() which sets input_state */
|
||||||
svp.program_state.input_state = otherInp;
|
program_state.input_state = otherInp;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -986,7 +986,6 @@ static const struct instance_globals_saved_p init_svp = {
|
|||||||
DUMMY, /* plname */
|
DUMMY, /* plname */
|
||||||
DUMMY, /* pl_character */
|
DUMMY, /* pl_character */
|
||||||
DUMMY, /* pl_fruit */
|
DUMMY, /* pl_fruit */
|
||||||
UNDEFINED_VALUES, /* program_state */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct instance_globals_saved_q init_svq = {
|
static const struct instance_globals_saved_q init_svq = {
|
||||||
@@ -1029,6 +1028,8 @@ static const struct instance_globals_saved_y init_svy = {
|
|||||||
UNDEFINED_VALUE /* ymax */
|
UNDEFINED_VALUE /* ymax */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct sinfo init_program_state = { 0 };
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
struct instance_globals g;
|
struct instance_globals g;
|
||||||
#endif /* 0 */
|
#endif /* 0 */
|
||||||
@@ -1078,6 +1079,7 @@ struct instance_globals_saved_t svt;
|
|||||||
struct instance_globals_saved_u svu;
|
struct instance_globals_saved_u svu;
|
||||||
struct instance_globals_saved_x svx;
|
struct instance_globals_saved_x svx;
|
||||||
struct instance_globals_saved_y svy;
|
struct instance_globals_saved_y svy;
|
||||||
|
struct sinfo program_state;
|
||||||
|
|
||||||
const struct const_globals cg = {
|
const struct const_globals cg = {
|
||||||
DUMMY, /* zeroobj */
|
DUMMY, /* zeroobj */
|
||||||
@@ -1154,6 +1156,7 @@ decl_globals_init(void)
|
|||||||
svu = init_svu;
|
svu = init_svu;
|
||||||
svx = init_svx;
|
svx = init_svx;
|
||||||
svy = init_svy;
|
svy = init_svy;
|
||||||
|
program_state = init_program_state;
|
||||||
|
|
||||||
gv.valuables[0].list = gg.gems;
|
gv.valuables[0].list = gg.gems;
|
||||||
gv.valuables[0].size = SIZE(gg.gems);
|
gv.valuables[0].size = SIZE(gg.gems);
|
||||||
|
|||||||
+8
-8
@@ -676,10 +676,10 @@ next_to_gas(
|
|||||||
boolean
|
boolean
|
||||||
suppress_map_output(void)
|
suppress_map_output(void)
|
||||||
{
|
{
|
||||||
if (gi.in_mklev || svp.program_state.saving || svp.program_state.restoring)
|
if (gi.in_mklev || program_state.saving || program_state.restoring)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#ifdef HANGUPHANDLING
|
#ifdef HANGUPHANDLING
|
||||||
if (svp.program_state.done_hup)
|
if (program_state.done_hup)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#endif
|
#endif
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1658,10 +1658,10 @@ docrt_flags(int refresh_flags)
|
|||||||
redrawonly = (refresh_flags & docrtRefresh) != 0,
|
redrawonly = (refresh_flags & docrtRefresh) != 0,
|
||||||
nocls = (refresh_flags & docrtNocls) != 0;
|
nocls = (refresh_flags & docrtNocls) != 0;
|
||||||
|
|
||||||
if (!u.ux || svp.program_state.in_docrt)
|
if (!u.ux || program_state.in_docrt)
|
||||||
return; /* display isn't ready yet */
|
return; /* display isn't ready yet */
|
||||||
|
|
||||||
svp.program_state.in_docrt = TRUE;
|
program_state.in_docrt = TRUE;
|
||||||
|
|
||||||
if (redrawonly) {
|
if (redrawonly) {
|
||||||
redraw_map(FALSE);
|
redraw_map(FALSE);
|
||||||
@@ -1713,7 +1713,7 @@ docrt_flags(int refresh_flags)
|
|||||||
disp.botlx = TRUE; /* force a redraw of the bottom lines */
|
disp.botlx = TRUE; /* force a redraw of the bottom lines */
|
||||||
/* note: caller needs to call bot() to actually redraw status */
|
/* note: caller needs to call bot() to actually redraw status */
|
||||||
}
|
}
|
||||||
svp.program_state.in_docrt = FALSE;
|
program_state.in_docrt = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for panning beyond a clipped region; resend the current map data to
|
/* for panning beyond a clipped region; resend the current map data to
|
||||||
@@ -1949,8 +1949,8 @@ show_glyph(coordxy x, coordxy y, int glyph)
|
|||||||
oldglyph = gg.gbuf[y][x].glyphinfo.glyph;
|
oldglyph = gg.gbuf[y][x].glyphinfo.glyph;
|
||||||
|
|
||||||
if (a11y.glyph_updates && !a11y.mon_notices_blocked
|
if (a11y.glyph_updates && !a11y.mon_notices_blocked
|
||||||
&& !svp.program_state.in_docrt
|
&& !program_state.in_docrt
|
||||||
&& !svp.program_state.in_getlev
|
&& !program_state.in_getlev
|
||||||
&& (oldglyph != glyph || gg.gbuf[y][x].gnew)) {
|
&& (oldglyph != glyph || gg.gbuf[y][x].gnew)) {
|
||||||
int c = glyph_to_cmap(glyph);
|
int c = glyph_to_cmap(glyph);
|
||||||
if ((glyph_is_nothing(oldglyph) || glyph_is_unexplored(oldglyph)
|
if ((glyph_is_nothing(oldglyph) || glyph_is_unexplored(oldglyph)
|
||||||
@@ -2165,7 +2165,7 @@ flush_screen(int cursor_on_u)
|
|||||||
return; /* if already flushing then return */
|
return; /* if already flushing then return */
|
||||||
flushing = 1;
|
flushing = 1;
|
||||||
#ifdef HANGUPHANDLING
|
#ifdef HANGUPHANDLING
|
||||||
if (svp.program_state.done_hup)
|
if (program_state.done_hup)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -900,7 +900,7 @@ obj_no_longer_held(struct obj *obj)
|
|||||||
*/
|
*/
|
||||||
if (!obj->oerodeproof || !rn2(10)) {
|
if (!obj->oerodeproof || !rn2(10)) {
|
||||||
/* if monsters aren't moving, assume player is responsible */
|
/* if monsters aren't moving, assume player is responsible */
|
||||||
if (!svc.context.mon_moving && !svp.program_state.gameover)
|
if (!svc.context.mon_moving && !program_state.gameover)
|
||||||
costly_alteration(obj, COST_DEGRD);
|
costly_alteration(obj, COST_DEGRD);
|
||||||
obj->otyp = WORM_TOOTH;
|
obj->otyp = WORM_TOOTH;
|
||||||
obj->oerodeproof = 0;
|
obj->oerodeproof = 0;
|
||||||
@@ -1348,7 +1348,7 @@ save_currentstate(void)
|
|||||||
{
|
{
|
||||||
NHFILE *nhfp;
|
NHFILE *nhfp;
|
||||||
|
|
||||||
svp.program_state.in_checkpoint++;
|
program_state.in_checkpoint++;
|
||||||
if (flags.ins_chkpt) {
|
if (flags.ins_chkpt) {
|
||||||
/* write out just-attained level, with pets and everything */
|
/* write out just-attained level, with pets and everything */
|
||||||
nhfp = currentlevel_rewrite();
|
nhfp = currentlevel_rewrite();
|
||||||
@@ -1363,7 +1363,7 @@ save_currentstate(void)
|
|||||||
|
|
||||||
/* write out non-level state */
|
/* write out non-level state */
|
||||||
savestateinlock();
|
savestateinlock();
|
||||||
svp.program_state.in_checkpoint--;
|
program_state.in_checkpoint--;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -839,7 +839,7 @@ x_monnam(
|
|||||||
if (mtmp == &gy.youmonst)
|
if (mtmp == &gy.youmonst)
|
||||||
return strcpy(buf, "you"); /* ignore article, "invisible", &c */
|
return strcpy(buf, "you"); /* ignore article, "invisible", &c */
|
||||||
|
|
||||||
if (svp.program_state.gameover)
|
if (program_state.gameover)
|
||||||
suppress |= SUPPRESS_HALLUCINATION;
|
suppress |= SUPPRESS_HALLUCINATION;
|
||||||
if (article == ARTICLE_YOUR && !mtmp->mtame)
|
if (article == ARTICLE_YOUR && !mtmp->mtame)
|
||||||
article = ARTICLE_THE;
|
article = ARTICLE_THE;
|
||||||
@@ -857,7 +857,7 @@ x_monnam(
|
|||||||
do_hallu = Hallucination && !(suppress & SUPPRESS_HALLUCINATION);
|
do_hallu = Hallucination && !(suppress & SUPPRESS_HALLUCINATION);
|
||||||
do_invis = mtmp->minvis && !(suppress & SUPPRESS_INVISIBLE);
|
do_invis = mtmp->minvis && !(suppress & SUPPRESS_INVISIBLE);
|
||||||
do_it = !canspotmon(mtmp) && article != ARTICLE_YOUR
|
do_it = !canspotmon(mtmp) && article != ARTICLE_YOUR
|
||||||
&& !svp.program_state.gameover && mtmp != u.usteed
|
&& !program_state.gameover && mtmp != u.usteed
|
||||||
&& !engulfing_u(mtmp) && !(suppress & SUPPRESS_IT);
|
&& !engulfing_u(mtmp) && !(suppress & SUPPRESS_IT);
|
||||||
do_saddle = !(suppress & SUPPRESS_SADDLE);
|
do_saddle = !(suppress & SUPPRESS_SADDLE);
|
||||||
do_mappear = mappear_as_mon && !(suppress & SUPPRESS_MAPPEARANCE);
|
do_mappear = mappear_as_mon && !(suppress & SUPPRESS_MAPPEARANCE);
|
||||||
@@ -1481,7 +1481,7 @@ const char *
|
|||||||
hliquid(
|
hliquid(
|
||||||
const char *liquidpref) /* use as-is when not hallucintg (unless empty) */
|
const char *liquidpref) /* use as-is when not hallucintg (unless empty) */
|
||||||
{
|
{
|
||||||
boolean hallucinate = Hallucination && !svp.program_state.gameover;
|
boolean hallucinate = Hallucination && !program_state.gameover;
|
||||||
|
|
||||||
if (hallucinate || !liquidpref || !*liquidpref) {
|
if (hallucinate || !liquidpref || !*liquidpref) {
|
||||||
int indx, count = SIZE(hliquids);
|
int indx, count = SIZE(hliquids);
|
||||||
|
|||||||
+1
-1
@@ -810,7 +810,7 @@ dragon_armor_handling(
|
|||||||
case GOLD_DRAGON_SCALES:
|
case GOLD_DRAGON_SCALES:
|
||||||
case GOLD_DRAGON_SCALE_MAIL:
|
case GOLD_DRAGON_SCALE_MAIL:
|
||||||
(void) make_hallucinated((long) !puton,
|
(void) make_hallucinated((long) !puton,
|
||||||
svp.program_state.restoring ? FALSE : TRUE,
|
program_state.restoring ? FALSE : TRUE,
|
||||||
W_ARM);
|
W_ARM);
|
||||||
break;
|
break;
|
||||||
case ORANGE_DRAGON_SCALES:
|
case ORANGE_DRAGON_SCALES:
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ ATTRNORETURN extern void nethack_exit(int) NORETURN;
|
|||||||
#define nethack_exit exit
|
#define nethack_exit exit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define done_stopprint svp.program_state.stopprint
|
#define done_stopprint program_state.stopprint
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The order of these needs to match the macros in hack.h.
|
* The order of these needs to match the macros in hack.h.
|
||||||
@@ -175,7 +175,7 @@ staticfn void
|
|||||||
done_hangup(int sig)
|
done_hangup(int sig)
|
||||||
{
|
{
|
||||||
#ifdef HANGUPHANDLING
|
#ifdef HANGUPHANDLING
|
||||||
svp.program_state.done_hup++;
|
program_state.done_hup++;
|
||||||
#endif
|
#endif
|
||||||
sethanguphandler((void (*)(int)) SIG_IGN);
|
sethanguphandler((void (*)(int)) SIG_IGN);
|
||||||
done_intr(sig);
|
done_intr(sig);
|
||||||
@@ -391,7 +391,7 @@ panic VA_DECL(const char *, str)
|
|||||||
VA_START(str);
|
VA_START(str);
|
||||||
VA_INIT(str, char *);
|
VA_INIT(str, char *);
|
||||||
|
|
||||||
if (svp.program_state.panicking++)
|
if (program_state.panicking++)
|
||||||
NH_abort(NULL); /* avoid loops - this should never happen*/
|
NH_abort(NULL); /* avoid loops - this should never happen*/
|
||||||
|
|
||||||
gb.bot_disabled = TRUE;
|
gb.bot_disabled = TRUE;
|
||||||
@@ -404,9 +404,9 @@ panic VA_DECL(const char *, str)
|
|||||||
iflags.window_inited = FALSE; /* they're gone; force raw_print()ing */
|
iflags.window_inited = FALSE; /* they're gone; force raw_print()ing */
|
||||||
}
|
}
|
||||||
|
|
||||||
raw_print(svp.program_state.gameover
|
raw_print(program_state.gameover
|
||||||
? "Postgame wrapup disrupted."
|
? "Postgame wrapup disrupted."
|
||||||
: !svp.program_state.something_worth_saving
|
: !program_state.something_worth_saving
|
||||||
? "Program initialization has failed."
|
? "Program initialization has failed."
|
||||||
: "Suddenly, the dungeon collapses.");
|
: "Suddenly, the dungeon collapses.");
|
||||||
#ifndef MICRO
|
#ifndef MICRO
|
||||||
@@ -414,11 +414,11 @@ panic VA_DECL(const char *, str)
|
|||||||
if (!wizard)
|
if (!wizard)
|
||||||
raw_printf("Report the following error to \"%s\" or at \"%s\".",
|
raw_printf("Report the following error to \"%s\" or at \"%s\".",
|
||||||
DEVTEAM_EMAIL, DEVTEAM_URL);
|
DEVTEAM_EMAIL, DEVTEAM_URL);
|
||||||
else if (svp.program_state.something_worth_saving)
|
else if (program_state.something_worth_saving)
|
||||||
raw_print("\nError save file being written.\n");
|
raw_print("\nError save file being written.\n");
|
||||||
#else /* !NOTIFY_NETHACK_BUGS */
|
#else /* !NOTIFY_NETHACK_BUGS */
|
||||||
if (!wizard) {
|
if (!wizard) {
|
||||||
const char *maybe_rebuild = !svp.program_state.something_worth_saving
|
const char *maybe_rebuild = !program_state.something_worth_saving
|
||||||
? "."
|
? "."
|
||||||
: "\nand it may be possible to rebuild.";
|
: "\nand it may be possible to rebuild.";
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ panic VA_DECL(const char *, str)
|
|||||||
/* XXX can we move this above the prints? Then we'd be able to
|
/* XXX can we move this above the prints? Then we'd be able to
|
||||||
* suppress "it may be possible to rebuild" based on dosave0()
|
* suppress "it may be possible to rebuild" based on dosave0()
|
||||||
* or say it's NOT possible to rebuild. */
|
* or say it's NOT possible to rebuild. */
|
||||||
if (svp.program_state.something_worth_saving && !iflags.debug_fuzzer) {
|
if (program_state.something_worth_saving && !iflags.debug_fuzzer) {
|
||||||
set_error_savefile();
|
set_error_savefile();
|
||||||
if (dosave0()) {
|
if (dosave0()) {
|
||||||
/* os/win port specific recover instructions */
|
/* os/win port specific recover instructions */
|
||||||
@@ -937,7 +937,7 @@ fuzzer_savelife(int how)
|
|||||||
* Some debugging code pulled out of done() to unclutter it.
|
* Some debugging code pulled out of done() to unclutter it.
|
||||||
* 'done_seq' is maintained in done().
|
* 'done_seq' is maintained in done().
|
||||||
*/
|
*/
|
||||||
if (!svp.program_state.panicking
|
if (!program_state.panicking
|
||||||
&& how != PANICKED && how != TRICKED) {
|
&& how != PANICKED && how != TRICKED) {
|
||||||
savelife(how);
|
savelife(how);
|
||||||
|
|
||||||
@@ -1019,9 +1019,9 @@ done(int how)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (svp.program_state.panicking
|
if (program_state.panicking
|
||||||
#ifdef HANGUPHANDLING
|
#ifdef HANGUPHANDLING
|
||||||
|| svp.program_state.done_hup
|
|| program_state.done_hup
|
||||||
#endif
|
#endif
|
||||||
|| (how == QUIT && done_stopprint)) {
|
|| (how == QUIT && done_stopprint)) {
|
||||||
/* skip status update if panicking or disconnected
|
/* skip status update if panicking or disconnected
|
||||||
@@ -1094,7 +1094,7 @@ done(int how)
|
|||||||
/* if hangup has occurred, the only possible answer to a paranoid
|
/* if hangup has occurred, the only possible answer to a paranoid
|
||||||
query is 'no'; we want 'no' as the default for "Die?" but can't
|
query is 'no'; we want 'no' as the default for "Die?" but can't
|
||||||
accept it more than once if there's no user supplying it */
|
accept it more than once if there's no user supplying it */
|
||||||
&& !(svp.program_state.done_hup && gd.done_seq++ == gh.hero_seq)
|
&& !(program_state.done_hup && gd.done_seq++ == gh.hero_seq)
|
||||||
#endif
|
#endif
|
||||||
&& !paranoid_query(ParanoidDie, "Die?")) {
|
&& !paranoid_query(ParanoidDie, "Die?")) {
|
||||||
pline("OK, so you don't %s.", (how == CHOKING) ? "choke" : "die");
|
pline("OK, so you don't %s.", (how == CHOKING) ? "choke" : "die");
|
||||||
@@ -1128,11 +1128,11 @@ really_done(int how)
|
|||||||
/*
|
/*
|
||||||
* The game is now over...
|
* The game is now over...
|
||||||
*/
|
*/
|
||||||
svp.program_state.gameover = 1;
|
program_state.gameover = 1;
|
||||||
/* in case of a subsequent panic(), there's no point trying to save */
|
/* in case of a subsequent panic(), there's no point trying to save */
|
||||||
svp.program_state.something_worth_saving = 0;
|
program_state.something_worth_saving = 0;
|
||||||
#ifdef HANGUPHANDLING
|
#ifdef HANGUPHANDLING
|
||||||
if (svp.program_state.done_hup)
|
if (program_state.done_hup)
|
||||||
done_stopprint++;
|
done_stopprint++;
|
||||||
#endif
|
#endif
|
||||||
/* render vision subsystem inoperative */
|
/* render vision subsystem inoperative */
|
||||||
@@ -1140,7 +1140,7 @@ really_done(int how)
|
|||||||
|
|
||||||
/* maybe use up active invent item(s), place thrown/kicked missile,
|
/* maybe use up active invent item(s), place thrown/kicked missile,
|
||||||
deal with ball and chain possibly being temporarily off the map */
|
deal with ball and chain possibly being temporarily off the map */
|
||||||
if (!svp.program_state.panicking)
|
if (!program_state.panicking)
|
||||||
done_object_cleanup();
|
done_object_cleanup();
|
||||||
/* in case we're panicking; normally cleared by done_object_cleanup() */
|
/* in case we're panicking; normally cleared by done_object_cleanup() */
|
||||||
iflags.perm_invent = FALSE;
|
iflags.perm_invent = FALSE;
|
||||||
@@ -1657,7 +1657,7 @@ container_contents(
|
|||||||
ATTRNORETURN void
|
ATTRNORETURN void
|
||||||
nh_terminate(int status)
|
nh_terminate(int status)
|
||||||
{
|
{
|
||||||
svp.program_state.in_moveloop = 0; /* won't be returning to normal play */
|
program_state.in_moveloop = 0; /* won't be returning to normal play */
|
||||||
|
|
||||||
l_nhcore_call(NHCORE_GAME_EXIT);
|
l_nhcore_call(NHCORE_GAME_EXIT);
|
||||||
#ifdef MAC
|
#ifdef MAC
|
||||||
@@ -1665,7 +1665,7 @@ nh_terminate(int status)
|
|||||||
#endif
|
#endif
|
||||||
/* don't bother to try to release memory if we're in panic mode, to
|
/* don't bother to try to release memory if we're in panic mode, to
|
||||||
avoid trouble in case that happens to be due to memory problems */
|
avoid trouble in case that happens to be due to memory problems */
|
||||||
if (!svp.program_state.panicking) {
|
if (!program_state.panicking) {
|
||||||
freedynamicdata();
|
freedynamicdata();
|
||||||
dlb_cleanup();
|
dlb_cleanup();
|
||||||
l_nhcore_done();
|
l_nhcore_done();
|
||||||
@@ -1679,10 +1679,10 @@ nh_terminate(int status)
|
|||||||
*/
|
*/
|
||||||
/* don't call exit() if already executing within an exit handler;
|
/* don't call exit() if already executing within an exit handler;
|
||||||
that would cancel any other pending user-mode handlers */
|
that would cancel any other pending user-mode handlers */
|
||||||
if (svp.program_state.exiting)
|
if (program_state.exiting)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
svp.program_state.exiting = 1;
|
program_state.exiting = 1;
|
||||||
nethack_exit(status);
|
nethack_exit(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-16
@@ -703,7 +703,7 @@ clearlocks(void)
|
|||||||
int x;
|
int x;
|
||||||
|
|
||||||
#ifdef HANGUPHANDLING
|
#ifdef HANGUPHANDLING
|
||||||
if (svp.program_state.preserve_locks)
|
if (program_state.preserve_locks)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
#ifndef NO_SIGNAL
|
#ifndef NO_SIGNAL
|
||||||
@@ -1101,7 +1101,7 @@ create_savefile(void)
|
|||||||
nhfp->fieldlevel = FALSE;
|
nhfp->fieldlevel = FALSE;
|
||||||
nhfp->ftype = NHF_SAVEFILE;
|
nhfp->ftype = NHF_SAVEFILE;
|
||||||
nhfp->mode = WRITING;
|
nhfp->mode = WRITING;
|
||||||
if (svp.program_state.in_self_recover || do_historical) {
|
if (program_state.in_self_recover || do_historical) {
|
||||||
do_historical = TRUE; /* force it */
|
do_historical = TRUE; /* force it */
|
||||||
nhfp->structlevel = TRUE;
|
nhfp->structlevel = TRUE;
|
||||||
nhfp->fieldlevel = FALSE;
|
nhfp->fieldlevel = FALSE;
|
||||||
@@ -1155,7 +1155,7 @@ open_savefile(void)
|
|||||||
nhfp->fieldlevel = FALSE;
|
nhfp->fieldlevel = FALSE;
|
||||||
nhfp->ftype = NHF_SAVEFILE;
|
nhfp->ftype = NHF_SAVEFILE;
|
||||||
nhfp->mode = READING;
|
nhfp->mode = READING;
|
||||||
if (svp.program_state.in_self_recover || do_historical) {
|
if (program_state.in_self_recover || do_historical) {
|
||||||
do_historical = TRUE; /* force it */
|
do_historical = TRUE; /* force it */
|
||||||
nhfp->structlevel = TRUE;
|
nhfp->structlevel = TRUE;
|
||||||
nhfp->fieldlevel = FALSE;
|
nhfp->fieldlevel = FALSE;
|
||||||
@@ -1875,7 +1875,7 @@ static struct flock sflock; /* for unlocking, same as above */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
#define HUP if (!svp.program_state.done_hup)
|
#define HUP if (!program_state.done_hup)
|
||||||
#else
|
#else
|
||||||
#define HUP
|
#define HUP
|
||||||
#endif
|
#endif
|
||||||
@@ -3447,7 +3447,7 @@ config_error_init(boolean from_file, const char *sourcename, boolean secure)
|
|||||||
|
|
||||||
tmp->next = config_error_data;
|
tmp->next = config_error_data;
|
||||||
config_error_data = tmp;
|
config_error_data = tmp;
|
||||||
svp.program_state.config_error_ready = TRUE;
|
program_state.config_error_ready = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
staticfn boolean
|
staticfn boolean
|
||||||
@@ -3513,7 +3513,7 @@ config_erradd(const char *buf)
|
|||||||
punct = c_eos((char *) buf) - 1; /* eos(buf)-1 is valid */
|
punct = c_eos((char *) buf) - 1; /* eos(buf)-1 is valid */
|
||||||
punct = strchr(".!?", *punct) ? "" : ".";
|
punct = strchr(".!?", *punct) ? "" : ".";
|
||||||
|
|
||||||
if (!svp.program_state.config_error_ready) {
|
if (!program_state.config_error_ready) {
|
||||||
/* either very early, where pline() will use raw_print(), or
|
/* either very early, where pline() will use raw_print(), or
|
||||||
player gave bad value when prompted by interactive 'O' command */
|
player gave bad value when prompted by interactive 'O' command */
|
||||||
pline("%s%s%s", !iflags.window_inited ? "config_error_add: " : "",
|
pline("%s%s%s", !iflags.window_inited ? "config_error_add: " : "",
|
||||||
@@ -3575,7 +3575,7 @@ config_error_done(void)
|
|||||||
}
|
}
|
||||||
config_error_data = tmp->next;
|
config_error_data = tmp->next;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
svp.program_state.config_error_ready = (config_error_data != 0);
|
program_state.config_error_ready = (config_error_data != 0);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3978,14 +3978,14 @@ read_wizkit(void)
|
|||||||
if (!wizard || !(fp = fopen_wizkit_file()))
|
if (!wizard || !(fp = fopen_wizkit_file()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
svp.program_state.wizkit_wishing = 1;
|
program_state.wizkit_wishing = 1;
|
||||||
config_error_init(TRUE, "WIZKIT", FALSE);
|
config_error_init(TRUE, "WIZKIT", FALSE);
|
||||||
|
|
||||||
parse_conf_file(fp, proc_wizkit_line);
|
parse_conf_file(fp, proc_wizkit_line);
|
||||||
(void) fclose(fp);
|
(void) fclose(fp);
|
||||||
|
|
||||||
config_error_done();
|
config_error_done();
|
||||||
svp.program_state.wizkit_wishing = 0;
|
program_state.wizkit_wishing = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4195,8 +4195,8 @@ paniclog(
|
|||||||
#ifdef PANICLOG
|
#ifdef PANICLOG
|
||||||
FILE *lfile;
|
FILE *lfile;
|
||||||
|
|
||||||
if (!svp.program_state.in_paniclog) {
|
if (!program_state.in_paniclog) {
|
||||||
svp.program_state.in_paniclog = 1;
|
program_state.in_paniclog = 1;
|
||||||
lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX);
|
lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX);
|
||||||
if (lfile) {
|
if (lfile) {
|
||||||
#ifdef PANICLOG_FMT2
|
#ifdef PANICLOG_FMT2
|
||||||
@@ -4216,7 +4216,7 @@ paniclog(
|
|||||||
#endif /* !PANICLOG_FMT2 */
|
#endif /* !PANICLOG_FMT2 */
|
||||||
(void) fclose(lfile);
|
(void) fclose(lfile);
|
||||||
}
|
}
|
||||||
svp.program_state.in_paniclog = 0;
|
program_state.in_paniclog = 0;
|
||||||
}
|
}
|
||||||
#endif /* PANICLOG */
|
#endif /* PANICLOG */
|
||||||
return;
|
return;
|
||||||
@@ -4323,9 +4323,9 @@ recover_savefile(void)
|
|||||||
/*
|
/*
|
||||||
* Set a flag for the savefile routines to know the
|
* Set a flag for the savefile routines to know the
|
||||||
* circumstances and act accordingly:
|
* circumstances and act accordingly:
|
||||||
* svp.program_state.in_self_recover
|
* program_state.in_self_recover
|
||||||
*/
|
*/
|
||||||
svp.program_state.in_self_recover = TRUE;
|
program_state.in_self_recover = TRUE;
|
||||||
set_savefile_name(TRUE);
|
set_savefile_name(TRUE);
|
||||||
snhfp = create_savefile();
|
snhfp = create_savefile();
|
||||||
if (!snhfp) {
|
if (!snhfp) {
|
||||||
@@ -4433,11 +4433,11 @@ recover_savefile(void)
|
|||||||
close_nhfile(gnhfp);
|
close_nhfile(gnhfp);
|
||||||
close_nhfile(snhfp);
|
close_nhfile(snhfp);
|
||||||
close_nhfile(lnhfp);
|
close_nhfile(lnhfp);
|
||||||
svp.program_state.in_self_recover = FALSE;
|
program_state.in_self_recover = FALSE;
|
||||||
delete_savefile();
|
delete_savefile();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* we don't clear svp.program_state.in_self_recover here, we
|
/* we don't clear program_state.in_self_recover here, we
|
||||||
leave it as a flag to reload the structlevel savefile
|
leave it as a flag to reload the structlevel savefile
|
||||||
in the caller. The caller should then clear it. */
|
in the caller. The caller should then clear it. */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|||||||
+5
-5
@@ -2395,7 +2395,7 @@ record_achievement(schar achidx)
|
|||||||
/* avoid livelog for achievements recorded during final disclosure:
|
/* avoid livelog for achievements recorded during final disclosure:
|
||||||
nudist and blind-from-birth; also ascension which is suppressed
|
nudist and blind-from-birth; also ascension which is suppressed
|
||||||
by this gets logged separately in really_done() */
|
by this gets logged separately in really_done() */
|
||||||
if (svp.program_state.gameover)
|
if (program_state.gameover)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (absidx >= ACH_RNK1 && absidx <= ACH_RNK8) {
|
if (absidx >= ACH_RNK1 && absidx <= ACH_RNK8) {
|
||||||
@@ -2717,7 +2717,7 @@ dovanquished(void)
|
|||||||
#define UniqCritterIndx(mndx) \
|
#define UniqCritterIndx(mndx) \
|
||||||
((mons[mndx].geno & G_UNIQ) != 0 && mndx != PM_HIGH_CLERIC)
|
((mons[mndx].geno & G_UNIQ) != 0 && mndx != PM_HIGH_CLERIC)
|
||||||
|
|
||||||
#define done_stopprint svp.program_state.stopprint
|
#define done_stopprint program_state.stopprint
|
||||||
|
|
||||||
void
|
void
|
||||||
list_vanquished(char defquery, boolean ask)
|
list_vanquished(char defquery, boolean ask)
|
||||||
@@ -2852,7 +2852,7 @@ list_vanquished(char defquery, boolean ask)
|
|||||||
* still in progress, so use present tense via pline(), or for dumplog
|
* still in progress, so use present tense via pline(), or for dumplog
|
||||||
* which needs putstr() and past tense.
|
* which needs putstr() and past tense.
|
||||||
*/
|
*/
|
||||||
} else if (!svp.program_state.gameover) {
|
} else if (!program_state.gameover) {
|
||||||
/* #vanquished rather than final disclosure, so pline() is ok */
|
/* #vanquished rather than final disclosure, so pline() is ok */
|
||||||
pline("No creatures have been vanquished.");
|
pline("No creatures have been vanquished.");
|
||||||
#ifdef DUMPLOG
|
#ifdef DUMPLOG
|
||||||
@@ -2927,7 +2927,7 @@ list_genocided(char defquery, boolean ask)
|
|||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
boolean genoing, /* prompting for genocide or class genocide */
|
boolean genoing, /* prompting for genocide or class genocide */
|
||||||
dumping; /* for DUMPLOG; doesn't need to be conditional */
|
dumping; /* for DUMPLOG; doesn't need to be conditional */
|
||||||
boolean both = (svp.program_state.gameover || wizard || discover);
|
boolean both = (program_state.gameover || wizard || discover);
|
||||||
|
|
||||||
dumping = (defquery == 'd');
|
dumping = (defquery == 'd');
|
||||||
genoing = (defquery == 'g');
|
genoing = (defquery == 'g');
|
||||||
@@ -3031,7 +3031,7 @@ list_genocided(char defquery, boolean ask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* See the comment for similar code near the end of list_vanquished(). */
|
/* See the comment for similar code near the end of list_vanquished(). */
|
||||||
} else if (!svp.program_state.gameover) {
|
} else if (!program_state.gameover) {
|
||||||
/* #genocided rather than final disclosure, so pline() is ok and
|
/* #genocided rather than final disclosure, so pline() is ok and
|
||||||
extinction has been ignored */
|
extinction has been ignored */
|
||||||
pline("No creatures have been genocided%s.", genoing ? " yet" : "");
|
pline("No creatures have been genocided%s.", genoing ? " yet" : "");
|
||||||
|
|||||||
+4
-4
@@ -355,7 +355,7 @@ loot_xname(struct obj *obj)
|
|||||||
if (wizard) { /* flags.debug */
|
if (wizard) { /* flags.debug */
|
||||||
/* paranoia: before toggling off wizard mode, guard against a
|
/* paranoia: before toggling off wizard mode, guard against a
|
||||||
panic in xname() producing a normal mode panic save file */
|
panic in xname() producing a normal mode panic save file */
|
||||||
svp.program_state.something_worth_saving = 0;
|
program_state.something_worth_saving = 0;
|
||||||
flags.debug = FALSE;
|
flags.debug = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,7 +363,7 @@ loot_xname(struct obj *obj)
|
|||||||
|
|
||||||
if (save_debug) {
|
if (save_debug) {
|
||||||
flags.debug = TRUE;
|
flags.debug = TRUE;
|
||||||
svp.program_state.something_worth_saving = 1;
|
program_state.something_worth_saving = 1;
|
||||||
}
|
}
|
||||||
/* restore the object */
|
/* restore the object */
|
||||||
if (obj->oclass == POTION_CLASS) {
|
if (obj->oclass == POTION_CLASS) {
|
||||||
@@ -2650,7 +2650,7 @@ update_inventory(void)
|
|||||||
{
|
{
|
||||||
int save_suppress_price;
|
int save_suppress_price;
|
||||||
|
|
||||||
if (!svp.program_state.in_moveloop) /* not covered by suppress_map_output */
|
if (!program_state.in_moveloop) /* not covered by suppress_map_output */
|
||||||
return;
|
return;
|
||||||
if (suppress_map_output()) /* despite name, used for perm_invent too */
|
if (suppress_map_output()) /* despite name, used for perm_invent too */
|
||||||
return;
|
return;
|
||||||
@@ -6120,7 +6120,7 @@ sync_perminvent(void)
|
|||||||
WIN_INVEN = create_nhwindow(NHW_MENU);
|
WIN_INVEN = create_nhwindow(NHW_MENU);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WIN_INVEN != WIN_ERR && svp.program_state.beyond_savefile_load) {
|
if (WIN_INVEN != WIN_ERR && program_state.beyond_savefile_load) {
|
||||||
gi.in_sync_perminvent = 1;
|
gi.in_sync_perminvent = 1;
|
||||||
(void) display_inventory((char *) 0, FALSE);
|
(void) display_inventory((char *) 0, FALSE);
|
||||||
gi.in_sync_perminvent = 0;
|
gi.in_sync_perminvent = 0;
|
||||||
|
|||||||
+2
-2
@@ -1755,7 +1755,7 @@ restore_waterlevel(NHFILE *nhfp)
|
|||||||
b->next = (struct bubble *) 0;
|
b->next = (struct bubble *) 0;
|
||||||
} else {
|
} else {
|
||||||
/* avoid "saving and reloading may fix this" */
|
/* avoid "saving and reloading may fix this" */
|
||||||
svp.program_state.something_worth_saving = 0;
|
program_state.something_worth_saving = 0;
|
||||||
/* during restore, information about what level this is might not
|
/* during restore, information about what level this is might not
|
||||||
be available so we're wishy-washy about what we describe */
|
be available so we're wishy-washy about what we describe */
|
||||||
impossible("No %s to restore?",
|
impossible("No %s to restore?",
|
||||||
@@ -1764,7 +1764,7 @@ restore_waterlevel(NHFILE *nhfp)
|
|||||||
: (Is_airlevel(&u.uz) || Is_airlevel(&gu.uz_save))
|
: (Is_airlevel(&u.uz) || Is_airlevel(&gu.uz_save))
|
||||||
? "clouds"
|
? "clouds"
|
||||||
: "air bubbles or clouds");
|
: "air bubbles or clouds");
|
||||||
svp.program_state.something_worth_saving = 1;
|
program_state.something_worth_saving = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1176,7 +1176,7 @@ movemon_singlemon(struct monst *mtmp)
|
|||||||
if (u.utotype
|
if (u.utotype
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
/* or if the program has lost contact with the user */
|
/* or if the program has lost contact with the user */
|
||||||
|| svp.program_state.done_hup
|
|| program_state.done_hup
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
gs.somebody_can_move = FALSE;
|
gs.somebody_can_move = FALSE;
|
||||||
|
|||||||
+1
-1
@@ -460,7 +460,7 @@ discover_object(
|
|||||||
exercise(A_WIS, TRUE);
|
exercise(A_WIS, TRUE);
|
||||||
}
|
}
|
||||||
/* !in_moveloop => initial inventory, gameover => final disclosure */
|
/* !in_moveloop => initial inventory, gameover => final disclosure */
|
||||||
if (svp.program_state.in_moveloop && !svp.program_state.gameover) {
|
if (program_state.in_moveloop && !program_state.gameover) {
|
||||||
if (objects[oindx].oc_class == GEM_CLASS)
|
if (objects[oindx].oc_class == GEM_CLASS)
|
||||||
gem_learned(oindx); /* could affect price of unpaid gems */
|
gem_learned(oindx); /* could affect price of unpaid gems */
|
||||||
update_inventory();
|
update_inventory();
|
||||||
|
|||||||
+6
-6
@@ -325,7 +325,7 @@ obj_is_pname(struct obj *obj)
|
|||||||
{
|
{
|
||||||
if (!obj->oartifact || !has_oname(obj))
|
if (!obj->oartifact || !has_oname(obj))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!svp.program_state.gameover && !iflags.override_ID) {
|
if (!program_state.gameover && !iflags.override_ID) {
|
||||||
if (not_fully_identified(obj))
|
if (not_fully_identified(obj))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -371,7 +371,7 @@ distant_name(
|
|||||||
against a potential extra chance to browse the map with getpos()
|
against a potential extra chance to browse the map with getpos()
|
||||||
during final disclosure (not currently implemented, nor planned) */
|
during final disclosure (not currently implemented, nor planned) */
|
||||||
save_oid = obj->o_id;
|
save_oid = obj->o_id;
|
||||||
if (svp.program_state.gameover)
|
if (program_state.gameover)
|
||||||
obj->o_id = 0;
|
obj->o_id = 0;
|
||||||
|
|
||||||
/* this maybe-nearby part used to be replicated in multiple callers */
|
/* this maybe-nearby part used to be replicated in multiple callers */
|
||||||
@@ -955,7 +955,7 @@ xname_flags(
|
|||||||
"You were acid resistant because of your alchemy smock \
|
"You were acid resistant because of your alchemy smock \
|
||||||
with text \"Kiss the cook\"."
|
with text \"Kiss the cook\"."
|
||||||
when disclosing attributes anyway */
|
when disclosing attributes anyway */
|
||||||
if (svp.program_state.gameover && obj->o_id && bufspaceleft > 0) {
|
if (program_state.gameover && obj->o_id && bufspaceleft > 0) {
|
||||||
const char *lbl;
|
const char *lbl;
|
||||||
char tmpbuf[BUFSZ];
|
char tmpbuf[BUFSZ];
|
||||||
|
|
||||||
@@ -1625,7 +1625,7 @@ doname_base(
|
|||||||
bill might not be available yet while restore is in progress
|
bill might not be available yet while restore is in progress
|
||||||
(objects won't normally be formatted during that time, but if
|
(objects won't normally be formatted during that time, but if
|
||||||
'perm_invent' is enabled then they might be [not any more...]) */
|
'perm_invent' is enabled then they might be [not any more...]) */
|
||||||
if (iflags.suppress_price || svp.program_state.restoring) {
|
if (iflags.suppress_price || program_state.restoring) {
|
||||||
; /* don't attempt to obtain any shop pricing, even if 'with_price' */
|
; /* don't attempt to obtain any shop pricing, even if 'with_price' */
|
||||||
} else if (is_unpaid(obj)) { /* in inventory or in container in invent */
|
} else if (is_unpaid(obj)) { /* in inventory or in container in invent */
|
||||||
char pricebuf[40];
|
char pricebuf[40];
|
||||||
@@ -4894,7 +4894,7 @@ readobjnam(char *bp, struct obj *no_wish)
|
|||||||
* Disallow such topology tweaks for WIZKIT startup wishes.
|
* Disallow such topology tweaks for WIZKIT startup wishes.
|
||||||
*/
|
*/
|
||||||
wiztrap:
|
wiztrap:
|
||||||
if (wizard && !svp.program_state.wizkit_wishing && !d.oclass) {
|
if (wizard && !program_state.wizkit_wishing && !d.oclass) {
|
||||||
/* [inline code moved to separate routine to unclutter readobjnam] */
|
/* [inline code moved to separate routine to unclutter readobjnam] */
|
||||||
if ((d.otmp = wizterrainwish(&d)) != 0)
|
if ((d.otmp = wizterrainwish(&d)) != 0)
|
||||||
return d.otmp;
|
return d.otmp;
|
||||||
@@ -4982,7 +4982,7 @@ readobjnam(char *bp, struct obj *no_wish)
|
|||||||
if (rn1cnt > 6 - d.gsize)
|
if (rn1cnt > 6 - d.gsize)
|
||||||
rn1cnt = 6 - d.gsize;
|
rn1cnt = 6 - d.gsize;
|
||||||
if (d.cnt > rn1cnt
|
if (d.cnt > rn1cnt
|
||||||
&& (!wizard || svp.program_state.wizkit_wishing
|
&& (!wizard || program_state.wizkit_wishing
|
||||||
|| y_n("Override glob weight limit?") != 'y'))
|
|| y_n("Override glob weight limit?") != 'y'))
|
||||||
d.cnt = rn1cnt;
|
d.cnt = rn1cnt;
|
||||||
d.otmp->owt *= (unsigned) d.cnt;
|
d.otmp->owt *= (unsigned) d.cnt;
|
||||||
|
|||||||
+3
-3
@@ -578,7 +578,7 @@ parseoptions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allow optfn's to test whether they were called from parseoptions() */
|
/* allow optfn's to test whether they were called from parseoptions() */
|
||||||
svp.program_state.in_parseoptions++;
|
program_state.in_parseoptions++;
|
||||||
|
|
||||||
if (got_match && matchidx >= 0) {
|
if (got_match && matchidx >= 0) {
|
||||||
duplicate = duplicate_opt_detection(matchidx);
|
duplicate = duplicate_opt_detection(matchidx);
|
||||||
@@ -604,8 +604,8 @@ parseoptions(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (svp.program_state.in_parseoptions > 0)
|
if (program_state.in_parseoptions > 0)
|
||||||
svp.program_state.in_parseoptions--;
|
program_state.in_parseoptions--;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* This specialization shouldn't be needed any longer because each of
|
/* This specialization shouldn't be needed any longer because each of
|
||||||
|
|||||||
+2
-2
@@ -507,7 +507,7 @@ waterbody_name(coordxy x, coordxy y)
|
|||||||
{
|
{
|
||||||
static char pooltype[40];
|
static char pooltype[40];
|
||||||
schar ltyp;
|
schar ltyp;
|
||||||
boolean hallucinate = Hallucination && !svp.program_state.gameover;
|
boolean hallucinate = Hallucination && !program_state.gameover;
|
||||||
|
|
||||||
if (!isok(x, y))
|
if (!isok(x, y))
|
||||||
return "drink"; /* should never happen */
|
return "drink"; /* should never happen */
|
||||||
@@ -1203,7 +1203,7 @@ do_screen_description(
|
|||||||
skipped_venom = 0, found = 0; /* count of matching syms found */
|
skipped_venom = 0, found = 0; /* count of matching syms found */
|
||||||
boolean hit_trap, need_to_look = FALSE,
|
boolean hit_trap, need_to_look = FALSE,
|
||||||
submerged = (Underwater && !Is_waterlevel(&u.uz)),
|
submerged = (Underwater && !Is_waterlevel(&u.uz)),
|
||||||
hallucinate = (Hallucination && !svp.program_state.gameover);
|
hallucinate = (Hallucination && !program_state.gameover);
|
||||||
const char *x_str;
|
const char *x_str;
|
||||||
nhsym tmpsym;
|
nhsym tmpsym;
|
||||||
glyph_info glyphinfo = nul_glyphinfo;
|
glyph_info glyphinfo = nul_glyphinfo;
|
||||||
|
|||||||
+10
-10
@@ -157,10 +157,10 @@ vpline(const char *line, va_list the_args)
|
|||||||
if (!line || !*line)
|
if (!line || !*line)
|
||||||
return;
|
return;
|
||||||
#ifdef HANGUPHANDLING
|
#ifdef HANGUPHANDLING
|
||||||
if (svp.program_state.done_hup)
|
if (program_state.done_hup)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
if (svp.program_state.wizkit_wishing)
|
if (program_state.wizkit_wishing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (a11y.accessiblemsg && isok(a11y.msg_loc.x,a11y.msg_loc.y)) {
|
if (a11y.accessiblemsg && isok(a11y.msg_loc.x,a11y.msg_loc.y)) {
|
||||||
@@ -542,7 +542,7 @@ raw_printf(const char *line, ...)
|
|||||||
va_start(the_args, line);
|
va_start(the_args, line);
|
||||||
vraw_printf(line, the_args);
|
vraw_printf(line, the_args);
|
||||||
va_end(the_args);
|
va_end(the_args);
|
||||||
if (!svp.program_state.beyond_savefile_load)
|
if (!program_state.beyond_savefile_load)
|
||||||
ge.early_raw_messages++;
|
ge.early_raw_messages++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,7 +567,7 @@ vraw_printf(const char *line, va_list the_args)
|
|||||||
#if defined(MSGHANDLER)
|
#if defined(MSGHANDLER)
|
||||||
execplinehandler(line);
|
execplinehandler(line);
|
||||||
#endif
|
#endif
|
||||||
if (!svp.program_state.beyond_savefile_load)
|
if (!program_state.beyond_savefile_load)
|
||||||
ge.early_raw_messages++;
|
ge.early_raw_messages++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -579,10 +579,10 @@ impossible(const char *s, ...)
|
|||||||
char pbuf2[BUFSZ];
|
char pbuf2[BUFSZ];
|
||||||
|
|
||||||
va_start(the_args, s);
|
va_start(the_args, s);
|
||||||
if (svp.program_state.in_impossible)
|
if (program_state.in_impossible)
|
||||||
panic("impossible called impossible");
|
panic("impossible called impossible");
|
||||||
|
|
||||||
svp.program_state.in_impossible = 1;
|
program_state.in_impossible = 1;
|
||||||
(void) vsnprintf(pbuf, sizeof pbuf, s, the_args);
|
(void) vsnprintf(pbuf, sizeof pbuf, s, the_args);
|
||||||
va_end(the_args);
|
va_end(the_args);
|
||||||
pbuf[BUFSZ - 1] = '\0'; /* sanity */
|
pbuf[BUFSZ - 1] = '\0'; /* sanity */
|
||||||
@@ -594,14 +594,14 @@ impossible(const char *s, ...)
|
|||||||
pline("%s", pbuf);
|
pline("%s", pbuf);
|
||||||
gp.pline_flags = 0;
|
gp.pline_flags = 0;
|
||||||
|
|
||||||
if (svp.program_state.in_sanity_check) {
|
if (program_state.in_sanity_check) {
|
||||||
/* skip rest of multi-line feedback */
|
/* skip rest of multi-line feedback */
|
||||||
svp.program_state.in_impossible = 0;
|
program_state.in_impossible = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Strcpy(pbuf2, "Program in disorder!");
|
Strcpy(pbuf2, "Program in disorder!");
|
||||||
if (svp.program_state.something_worth_saving)
|
if (program_state.something_worth_saving)
|
||||||
Strcat(pbuf2, " (Saving and reloading may fix this problem.)");
|
Strcat(pbuf2, " (Saving and reloading may fix this problem.)");
|
||||||
pline("%s", pbuf2);
|
pline("%s", pbuf2);
|
||||||
pline("Please report these messages to %s.", DEVTEAM_EMAIL);
|
pline("Please report these messages to %s.", DEVTEAM_EMAIL);
|
||||||
@@ -621,7 +621,7 @@ impossible(const char *s, ...)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
svp.program_state.in_impossible = 0;
|
program_state.in_impossible = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RESTORE_WARNING_FORMAT_NONLITERAL
|
RESTORE_WARNING_FORMAT_NONLITERAL
|
||||||
|
|||||||
+1
-1
@@ -109,7 +109,7 @@ set_uasmon(void)
|
|||||||
which won't be known during the restore process: but BFlying
|
which won't be known during the restore process: but BFlying
|
||||||
and BStealth should be set correctly already in that case, so
|
and BStealth should be set correctly already in that case, so
|
||||||
there's nothing to do */
|
there's nothing to do */
|
||||||
if (!svp.program_state.restoring)
|
if (!program_state.restoring)
|
||||||
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
|
float_vs_flight(); /* maybe toggle (BFlying & I_SPECIAL) */
|
||||||
polysense();
|
polysense();
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -365,7 +365,7 @@ priestname(
|
|||||||
/* same as distant_monnam(), more or less... */
|
/* same as distant_monnam(), more or less... */
|
||||||
if (do_hallu || !high_priest || reveal_high_priest
|
if (do_hallu || !high_priest || reveal_high_priest
|
||||||
|| !Is_astralevel(&u.uz)
|
|| !Is_astralevel(&u.uz)
|
||||||
|| m_next2u(mon) || svp.program_state.gameover) {
|
|| m_next2u(mon) || program_state.gameover) {
|
||||||
Strcat(pname, " of ");
|
Strcat(pname, " of ");
|
||||||
Strcat(pname, halu_gname(mon_aligntyp(mon)));
|
Strcat(pname, halu_gname(mon_aligntyp(mon)));
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -456,7 +456,7 @@ staticfn boolean
|
|||||||
skip_pager(boolean common UNUSED)
|
skip_pager(boolean common UNUSED)
|
||||||
{
|
{
|
||||||
/* WIZKIT: suppress plot feedback if starting with quest artifact */
|
/* WIZKIT: suppress plot feedback if starting with quest artifact */
|
||||||
if (svp.program_state.wizkit_wishing)
|
if (program_state.wizkit_wishing)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-14
@@ -721,7 +721,7 @@ restlevelfile(xint8 ltmp)
|
|||||||
nhfp = create_levelfile(ltmp, whynot);
|
nhfp = create_levelfile(ltmp, whynot);
|
||||||
if (!nhfp) {
|
if (!nhfp) {
|
||||||
/* failed to create a new file; don't attempt to make a panic save */
|
/* failed to create a new file; don't attempt to make a panic save */
|
||||||
svp.program_state.something_worth_saving = 0;
|
program_state.something_worth_saving = 0;
|
||||||
panic("restlevelfile: %s", whynot);
|
panic("restlevelfile: %s", whynot);
|
||||||
}
|
}
|
||||||
bufon(nhfp->fd);
|
bufon(nhfp->fd);
|
||||||
@@ -738,7 +738,7 @@ dorecover(NHFILE *nhfp)
|
|||||||
int rtmp;
|
int rtmp;
|
||||||
|
|
||||||
/* suppress map display if some part of the code tries to update that */
|
/* suppress map display if some part of the code tries to update that */
|
||||||
svp.program_state.restoring = REST_GSTATE;
|
program_state.restoring = REST_GSTATE;
|
||||||
|
|
||||||
get_plname_from_file(nhfp, svp.plname);
|
get_plname_from_file(nhfp, svp.plname);
|
||||||
getlev(nhfp, 0, (xint8) 0);
|
getlev(nhfp, 0, (xint8) 0);
|
||||||
@@ -755,7 +755,7 @@ dorecover(NHFILE *nhfp)
|
|||||||
close_nhfile(nhfp);
|
close_nhfile(nhfp);
|
||||||
(void) delete_savefile();
|
(void) delete_savefile();
|
||||||
u.usteed_mid = u.ustuck_mid = 0;
|
u.usteed_mid = u.ustuck_mid = 0;
|
||||||
svp.program_state.restoring = 0;
|
program_state.restoring = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* after restgamestate() -> restnames() so that 'bases[]' is populated */
|
/* after restgamestate() -> restnames() so that 'bases[]' is populated */
|
||||||
@@ -769,7 +769,7 @@ dorecover(NHFILE *nhfp)
|
|||||||
if (rtmp < 2)
|
if (rtmp < 2)
|
||||||
return rtmp; /* dorecover called recursively */
|
return rtmp; /* dorecover called recursively */
|
||||||
|
|
||||||
svp.program_state.restoring = REST_LEVELS;
|
program_state.restoring = REST_LEVELS;
|
||||||
|
|
||||||
/* these pointers won't be valid while we're processing the
|
/* these pointers won't be valid while we're processing the
|
||||||
* other levels, but they'll be reset again by restlevelstate()
|
* other levels, but they'll be reset again by restlevelstate()
|
||||||
@@ -831,12 +831,12 @@ dorecover(NHFILE *nhfp)
|
|||||||
get_plname_from_file(nhfp, svp.plname);
|
get_plname_from_file(nhfp, svp.plname);
|
||||||
|
|
||||||
/* not 0 nor REST_GSTATE nor REST_LEVELS */
|
/* not 0 nor REST_GSTATE nor REST_LEVELS */
|
||||||
svp.program_state.restoring = REST_CURRENT_LEVEL;
|
program_state.restoring = REST_CURRENT_LEVEL;
|
||||||
|
|
||||||
getlev(nhfp, 0, (xint8) 0);
|
getlev(nhfp, 0, (xint8) 0);
|
||||||
close_nhfile(nhfp);
|
close_nhfile(nhfp);
|
||||||
restlevelstate();
|
restlevelstate();
|
||||||
svp.program_state.something_worth_saving = 1; /* useful data now exists */
|
program_state.something_worth_saving = 1; /* useful data now exists */
|
||||||
|
|
||||||
if (!wizard && !discover)
|
if (!wizard && !discover)
|
||||||
(void) delete_savefile();
|
(void) delete_savefile();
|
||||||
@@ -866,9 +866,9 @@ dorecover(NHFILE *nhfp)
|
|||||||
gv.vision_full_recalc = 1; /* recompute vision (not saved) */
|
gv.vision_full_recalc = 1; /* recompute vision (not saved) */
|
||||||
|
|
||||||
run_timers(); /* expire all timers that have gone off while away */
|
run_timers(); /* expire all timers that have gone off while away */
|
||||||
svp.program_state.restoring = 0; /* affects bot() so clear before docrt() */
|
program_state.restoring = 0; /* affects bot() so clear before docrt() */
|
||||||
|
|
||||||
if (ge.early_raw_messages && !svp.program_state.beyond_savefile_load) {
|
if (ge.early_raw_messages && !program_state.beyond_savefile_load) {
|
||||||
/*
|
/*
|
||||||
* We're about to obliterate some potentially important
|
* We're about to obliterate some potentially important
|
||||||
* startup messages, so give the player a chance to see them.
|
* startup messages, so give the player a chance to see them.
|
||||||
@@ -877,7 +877,7 @@ dorecover(NHFILE *nhfp)
|
|||||||
wait_synch();
|
wait_synch();
|
||||||
}
|
}
|
||||||
u.usteed_mid = u.ustuck_mid = 0;
|
u.usteed_mid = u.ustuck_mid = 0;
|
||||||
svp.program_state.beyond_savefile_load = 1;
|
program_state.beyond_savefile_load = 1;
|
||||||
|
|
||||||
docrt();
|
docrt();
|
||||||
clear_nhwindow(WIN_MESSAGE);
|
clear_nhwindow(WIN_MESSAGE);
|
||||||
@@ -907,7 +907,7 @@ rest_stairs(NHFILE *nhfp)
|
|||||||
if (nhfp->structlevel) {
|
if (nhfp->structlevel) {
|
||||||
Mread(nhfp->fd, &stway, sizeof stway);
|
Mread(nhfp->fd, &stway, sizeof stway);
|
||||||
}
|
}
|
||||||
if (svp.program_state.restoring != REST_GSTATE
|
if (program_state.restoring != REST_GSTATE
|
||||||
&& stway.tolev.dnum == u.uz.dnum) {
|
&& stway.tolev.dnum == u.uz.dnum) {
|
||||||
/* stairway dlevel is relative, make it absolute */
|
/* stairway dlevel is relative, make it absolute */
|
||||||
stway.tolev.dlevel += u.uz.dlevel;
|
stway.tolev.dlevel += u.uz.dlevel;
|
||||||
@@ -1012,7 +1012,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
|
|||||||
short tlev;
|
short tlev;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
svp.program_state.in_getlev = TRUE;
|
program_state.in_getlev = TRUE;
|
||||||
|
|
||||||
if (ghostly)
|
if (ghostly)
|
||||||
clear_id_mapping();
|
clear_id_mapping();
|
||||||
@@ -1096,7 +1096,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
|
|||||||
if (nhfp->structlevel)
|
if (nhfp->structlevel)
|
||||||
Mread(nhfp->fd, trap, sizeof *trap);
|
Mread(nhfp->fd, trap, sizeof *trap);
|
||||||
if (trap->tx != 0) {
|
if (trap->tx != 0) {
|
||||||
if (svp.program_state.restoring != REST_GSTATE
|
if (program_state.restoring != REST_GSTATE
|
||||||
&& trap->dst.dnum == u.uz.dnum) {
|
&& trap->dst.dnum == u.uz.dnum) {
|
||||||
/* convert relative destination to absolute */
|
/* convert relative destination to absolute */
|
||||||
trap->dst.dlevel += u.uz.dlevel;
|
trap->dst.dlevel += u.uz.dlevel;
|
||||||
@@ -1140,7 +1140,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* regenerate monsters while on another level */
|
/* regenerate monsters while on another level */
|
||||||
if (!u.uz.dlevel || svp.program_state.restoring == REST_LEVELS)
|
if (!u.uz.dlevel || program_state.restoring == REST_LEVELS)
|
||||||
continue;
|
continue;
|
||||||
if (ghostly) {
|
if (ghostly) {
|
||||||
/* reset peaceful/malign relative to new character;
|
/* reset peaceful/malign relative to new character;
|
||||||
@@ -1242,7 +1242,7 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
|
|||||||
|
|
||||||
if (ghostly)
|
if (ghostly)
|
||||||
clear_id_mapping();
|
clear_id_mapping();
|
||||||
svp.program_state.in_getlev = FALSE;
|
program_state.in_getlev = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
+2
-2
@@ -2204,7 +2204,7 @@ genl_player_setup(int screenheight)
|
|||||||
char pick4u = 'n';
|
char pick4u = 'n';
|
||||||
int result = 0; /* assume failure (player chooses to 'quit') */
|
int result = 0; /* assume failure (player chooses to 'quit') */
|
||||||
|
|
||||||
svp.program_state.in_role_selection++; /* affects tty menu cleanup */
|
program_state.in_role_selection++; /* affects tty menu cleanup */
|
||||||
/* Used to avoid "Is this ok?" if player has already specified all
|
/* Used to avoid "Is this ok?" if player has already specified all
|
||||||
* four facets of role.
|
* four facets of role.
|
||||||
* Note that rigid_role_checks might force any unspecified facets to
|
* Note that rigid_role_checks might force any unspecified facets to
|
||||||
@@ -2704,7 +2704,7 @@ genl_player_setup(int screenheight)
|
|||||||
result = 1;
|
result = 1;
|
||||||
|
|
||||||
setup_done:
|
setup_done:
|
||||||
svp.program_state.in_role_selection--;
|
program_state.in_role_selection--;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -763,16 +763,16 @@ doconsult(struct monst *oracl)
|
|||||||
staticfn void
|
staticfn void
|
||||||
couldnt_open_file(const char *filename)
|
couldnt_open_file(const char *filename)
|
||||||
{
|
{
|
||||||
int save_something = svp.program_state.something_worth_saving;
|
int save_something = program_state.something_worth_saving;
|
||||||
|
|
||||||
/* most likely the file is missing, so suppress impossible()'s
|
/* most likely the file is missing, so suppress impossible()'s
|
||||||
"saving and restoring might fix this" (unless the fuzzer,
|
"saving and restoring might fix this" (unless the fuzzer,
|
||||||
which escalates impossible to panic, is running) */
|
which escalates impossible to panic, is running) */
|
||||||
if (!iflags.debug_fuzzer)
|
if (!iflags.debug_fuzzer)
|
||||||
svp.program_state.something_worth_saving = 0;
|
program_state.something_worth_saving = 0;
|
||||||
|
|
||||||
impossible("Can't open '%s' file.", filename);
|
impossible("Can't open '%s' file.", filename);
|
||||||
svp.program_state.something_worth_saving = save_something;
|
program_state.something_worth_saving = save_something;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* is 'word' a capitalized monster name that should be preceded by "the"?
|
/* is 'word' a capitalized monster name that should be preceded by "the"?
|
||||||
|
|||||||
+17
-17
@@ -41,7 +41,7 @@ staticfn void zerocomp_bputc(int);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
#define HUP if (!svp.program_state.done_hup)
|
#define HUP if (!program_state.done_hup)
|
||||||
#else
|
#else
|
||||||
#define HUP
|
#define HUP
|
||||||
#endif
|
#endif
|
||||||
@@ -59,7 +59,7 @@ dosave(void)
|
|||||||
clear_nhwindow(WIN_MESSAGE);
|
clear_nhwindow(WIN_MESSAGE);
|
||||||
pline("Saving...");
|
pline("Saving...");
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
svp.program_state.done_hup = 0;
|
program_state.done_hup = 0;
|
||||||
#endif
|
#endif
|
||||||
if (dosave0()) {
|
if (dosave0()) {
|
||||||
u.uhp = -1; /* universal game's over indicator */
|
u.uhp = -1; /* universal game's over indicator */
|
||||||
@@ -86,7 +86,7 @@ dosave0(void)
|
|||||||
NHFILE *nhfp, *onhfp;
|
NHFILE *nhfp, *onhfp;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
svp.program_state.saving++; /* inhibit status and perm_invent updates */
|
program_state.saving++; /* inhibit status and perm_invent updates */
|
||||||
/* we may get here via hangup signal, in which case we want to fix up
|
/* we may get here via hangup signal, in which case we want to fix up
|
||||||
a few of things before saving so that they won't be restored in
|
a few of things before saving so that they won't be restored in
|
||||||
an improper state; these will be no-ops for normal save sequence */
|
an improper state; these will be no-ops for normal save sequence */
|
||||||
@@ -103,7 +103,7 @@ dosave0(void)
|
|||||||
when punished, make sure ball and chain are placed too */
|
when punished, make sure ball and chain are placed too */
|
||||||
done_object_cleanup(); /* maybe force some items onto map */
|
done_object_cleanup(); /* maybe force some items onto map */
|
||||||
|
|
||||||
if (!svp.program_state.something_worth_saving || !gs.SAVEF[0])
|
if (!program_state.something_worth_saving || !gs.SAVEF[0])
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
fq_save = fqname(gs.SAVEF, SAVEPREFIX, 1); /* level files take 0 */
|
fq_save = fqname(gs.SAVEF, SAVEPREFIX, 1); /* level files take 0 */
|
||||||
@@ -230,11 +230,11 @@ dosave0(void)
|
|||||||
delete_levelfile(0);
|
delete_levelfile(0);
|
||||||
nh_compress(fq_save);
|
nh_compress(fq_save);
|
||||||
/* this should probably come sooner... */
|
/* this should probably come sooner... */
|
||||||
svp.program_state.something_worth_saving = 0;
|
program_state.something_worth_saving = 0;
|
||||||
res = 1;
|
res = 1;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
svp.program_state.saving--;
|
program_state.saving--;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ savegamestate(NHFILE *nhfp)
|
|||||||
{
|
{
|
||||||
unsigned long uid;
|
unsigned long uid;
|
||||||
|
|
||||||
svp.program_state.saving++; /* caller should/did already set this... */
|
program_state.saving++; /* caller should/did already set this... */
|
||||||
uid = (unsigned long) getuid();
|
uid = (unsigned long) getuid();
|
||||||
if (nhfp->structlevel) {
|
if (nhfp->structlevel) {
|
||||||
bwrite(nhfp->fd, (genericptr_t) &uid, sizeof uid);
|
bwrite(nhfp->fd, (genericptr_t) &uid, sizeof uid);
|
||||||
@@ -338,7 +338,7 @@ savegamestate(NHFILE *nhfp)
|
|||||||
save_luadata(nhfp);
|
save_luadata(nhfp);
|
||||||
if (nhfp->structlevel)
|
if (nhfp->structlevel)
|
||||||
bflush(nhfp->fd);
|
bflush(nhfp->fd);
|
||||||
svp.program_state.saving--;
|
program_state.saving--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,7 +364,7 @@ savestateinlock(void)
|
|||||||
char whynot[BUFSZ];
|
char whynot[BUFSZ];
|
||||||
NHFILE *nhfp;
|
NHFILE *nhfp;
|
||||||
|
|
||||||
svp.program_state.saving++; /* inhibit status and perm_invent updates */
|
program_state.saving++; /* inhibit status and perm_invent updates */
|
||||||
/* When checkpointing is on, the full state needs to be written
|
/* When checkpointing is on, the full state needs to be written
|
||||||
* on each checkpoint. When checkpointing is off, only the pid
|
* on each checkpoint. When checkpointing is off, only the pid
|
||||||
* needs to be in the level.0 file, so it does not need to be
|
* needs to be in the level.0 file, so it does not need to be
|
||||||
@@ -385,7 +385,7 @@ savestateinlock(void)
|
|||||||
*/
|
*/
|
||||||
nhfp = open_levelfile(0, whynot);
|
nhfp = open_levelfile(0, whynot);
|
||||||
if (tricked_fileremoved(nhfp, whynot)) {
|
if (tricked_fileremoved(nhfp, whynot)) {
|
||||||
svp.program_state.saving--;
|
program_state.saving--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -408,7 +408,7 @@ savestateinlock(void)
|
|||||||
than after so that screen updating behaves normally;
|
than after so that screen updating behaves normally;
|
||||||
game data shouldn't be inconsistent yet, unlike it would
|
game data shouldn't be inconsistent yet, unlike it would
|
||||||
become midway through saving */
|
become midway through saving */
|
||||||
svp.program_state.saving--;
|
program_state.saving--;
|
||||||
done(TRICKED);
|
done(TRICKED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -433,7 +433,7 @@ savestateinlock(void)
|
|||||||
}
|
}
|
||||||
close_nhfile(nhfp);
|
close_nhfile(nhfp);
|
||||||
}
|
}
|
||||||
svp.program_state.saving--;
|
program_state.saving--;
|
||||||
gh.havestate = flags.ins_chkpt;
|
gh.havestate = flags.ins_chkpt;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -450,7 +450,7 @@ savelev(NHFILE *nhfp, xint8 lev)
|
|||||||
but we'll be called during run-down */
|
but we'll be called during run-down */
|
||||||
if (set_uz_save && perform_bwrite(nhfp)) {
|
if (set_uz_save && perform_bwrite(nhfp)) {
|
||||||
if (u.uz.dnum == 0 && u.uz.dlevel == 0) {
|
if (u.uz.dnum == 0 && u.uz.dlevel == 0) {
|
||||||
svp.program_state.something_worth_saving = 0;
|
program_state.something_worth_saving = 0;
|
||||||
panic("savelev: where are we?");
|
panic("savelev: where are we?");
|
||||||
}
|
}
|
||||||
gu.uz_save = u.uz;
|
gu.uz_save = u.uz;
|
||||||
@@ -469,7 +469,7 @@ savelev_core(NHFILE *nhfp, xint8 lev)
|
|||||||
short tlev;
|
short tlev;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
svp.program_state.saving++; /* even if current mode is FREEING */
|
program_state.saving++; /* even if current mode is FREEING */
|
||||||
|
|
||||||
if (!nhfp)
|
if (!nhfp)
|
||||||
panic("Save on bad file!"); /* impossible */
|
panic("Save on bad file!"); /* impossible */
|
||||||
@@ -564,7 +564,7 @@ savelev_core(NHFILE *nhfp, xint8 lev)
|
|||||||
if (nhfp->structlevel)
|
if (nhfp->structlevel)
|
||||||
bflush(nhfp->fd);
|
bflush(nhfp->fd);
|
||||||
}
|
}
|
||||||
svp.program_state.saving--;
|
program_state.saving--;
|
||||||
if (release_data(nhfp)) {
|
if (release_data(nhfp)) {
|
||||||
clear_level_structures();
|
clear_level_structures();
|
||||||
gf.ftrap = 0;
|
gf.ftrap = 0;
|
||||||
@@ -717,7 +717,7 @@ save_stairs(NHFILE *nhfp)
|
|||||||
|
|
||||||
while (stway) {
|
while (stway) {
|
||||||
if (perform_bwrite(nhfp)) {
|
if (perform_bwrite(nhfp)) {
|
||||||
boolean use_relative = (svp.program_state.restoring != REST_GSTATE
|
boolean use_relative = (program_state.restoring != REST_GSTATE
|
||||||
&& stway->tolev.dnum == u.uz.dnum);
|
&& stway->tolev.dnum == u.uz.dnum);
|
||||||
if (use_relative) {
|
if (use_relative) {
|
||||||
/* make dlevel relative to current level */
|
/* make dlevel relative to current level */
|
||||||
@@ -988,7 +988,7 @@ savetrapchn(NHFILE *nhfp, struct trap *trap)
|
|||||||
struct trap *trap2;
|
struct trap *trap2;
|
||||||
|
|
||||||
while (trap) {
|
while (trap) {
|
||||||
boolean use_relative = (svp.program_state.restoring != REST_GSTATE
|
boolean use_relative = (program_state.restoring != REST_GSTATE
|
||||||
&& trap->dst.dnum == u.uz.dnum);
|
&& trap->dst.dnum == u.uz.dnum);
|
||||||
trap2 = trap->ntrap;
|
trap2 = trap->ntrap;
|
||||||
if (use_relative)
|
if (use_relative)
|
||||||
|
|||||||
+2
-2
@@ -194,7 +194,7 @@ bwrite(int fd, const genericptr_t loc, unsigned num)
|
|||||||
}
|
}
|
||||||
if (failed) {
|
if (failed) {
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
if (svp.program_state.done_hup)
|
if (program_state.done_hup)
|
||||||
nh_terminate(EXIT_FAILURE);
|
nh_terminate(EXIT_FAILURE);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@@ -230,7 +230,7 @@ mread(int fd, genericptr_t buf, unsigned len)
|
|||||||
} else {
|
} else {
|
||||||
pline("Read %d instead of %u bytes.", (int) rlen, len);
|
pline("Read %d instead of %u bytes.", (int) rlen, len);
|
||||||
display_nhwindow(WIN_MESSAGE, TRUE); /* flush before error() */
|
display_nhwindow(WIN_MESSAGE, TRUE); /* flush before error() */
|
||||||
if (svp.program_state.restoring) {
|
if (program_state.restoring) {
|
||||||
(void) nhclose(fd);
|
(void) nhclose(fd);
|
||||||
(void) delete_savefile();
|
(void) delete_savefile();
|
||||||
error("Error restoring old game.");
|
error("Error restoring old game.");
|
||||||
|
|||||||
@@ -4908,7 +4908,7 @@ after_shk_move(struct monst *shkp)
|
|||||||
/* reset bill_p, need to re-calc player's occupancy too */
|
/* reset bill_p, need to re-calc player's occupancy too */
|
||||||
eshkp->bill_p = &eshkp->bill[0];
|
eshkp->bill_p = &eshkp->bill[0];
|
||||||
/* only re-check occupancy if game hasn't just ended */
|
/* only re-check occupancy if game hasn't just ended */
|
||||||
if (!svp.program_state.gameover)
|
if (!program_state.gameover)
|
||||||
check_special_room(FALSE);
|
check_special_room(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -865,7 +865,7 @@ shkname(struct monst *mtmp)
|
|||||||
} else {
|
} else {
|
||||||
const char *shknm = ESHK(mtmp)->shknam;
|
const char *shknm = ESHK(mtmp)->shknam;
|
||||||
|
|
||||||
if (Hallucination && !svp.program_state.gameover) {
|
if (Hallucination && !program_state.gameover) {
|
||||||
const char *const *nlp;
|
const char *const *nlp;
|
||||||
int num;
|
int num;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -24,7 +24,7 @@
|
|||||||
static long final_fpos; /* [note: do not move this to the 'g' struct] */
|
static long final_fpos; /* [note: do not move this to the 'g' struct] */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define done_stopprint svp.program_state.stopprint
|
#define done_stopprint program_state.stopprint
|
||||||
|
|
||||||
#define newttentry() (struct toptenentry *) alloc(sizeof (struct toptenentry))
|
#define newttentry() (struct toptenentry *) alloc(sizeof (struct toptenentry))
|
||||||
#define dealloc_ttentry(ttent) free((genericptr_t) (ttent))
|
#define dealloc_ttentry(ttent) free((genericptr_t) (ttent))
|
||||||
@@ -642,7 +642,7 @@ topten(int how, time_t when)
|
|||||||
* topten uses alloc() several times, which will lead to
|
* topten uses alloc() several times, which will lead to
|
||||||
* problems if the panic was the result of an alloc() failure.
|
* problems if the panic was the result of an alloc() failure.
|
||||||
*/
|
*/
|
||||||
if (svp.program_state.panicking)
|
if (program_state.panicking)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (iflags.toptenwin) {
|
if (iflags.toptenwin) {
|
||||||
@@ -650,7 +650,7 @@ topten(int how, time_t when)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
#define HUP if (!svp.program_state.done_hup)
|
#define HUP if (!program_state.done_hup)
|
||||||
#else
|
#else
|
||||||
#define HUP
|
#define HUP
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ clear_fcorr(struct monst *grd, boolean forceshow)
|
|||||||
coordxy fcx, fcy, fcbeg;
|
coordxy fcx, fcy, fcbeg;
|
||||||
struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
boolean sawcorridor = FALSE,
|
boolean sawcorridor = FALSE,
|
||||||
silently = svp.program_state.stopprint ? TRUE : FALSE;
|
silently = program_state.stopprint ? TRUE : FALSE;
|
||||||
struct egd *egrd = EGD(grd);
|
struct egd *egrd = EGD(grd);
|
||||||
struct trap *trap;
|
struct trap *trap;
|
||||||
struct rm *lev;
|
struct rm *lev;
|
||||||
|
|||||||
+3
-3
@@ -521,7 +521,7 @@ vision_recalc(int control)
|
|||||||
int oldseenv; /* previous seenv value */
|
int oldseenv; /* previous seenv value */
|
||||||
|
|
||||||
gv.vision_full_recalc = 0; /* reset flag */
|
gv.vision_full_recalc = 0; /* reset flag */
|
||||||
if (gi.in_mklev || svp.program_state.in_getlev || !iflags.vision_inited)
|
if (gi.in_mklev || program_state.in_getlev || !iflags.vision_inited)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -825,9 +825,9 @@ vision_recalc(int control)
|
|||||||
/* This newsym() caused a crash delivering msg about failure to open
|
/* This newsym() caused a crash delivering msg about failure to open
|
||||||
* dungeon file init_dungeons() -> panic() -> done(11) ->
|
* dungeon file init_dungeons() -> panic() -> done(11) ->
|
||||||
* vision_recalc(2) -> newsym() -> crash! u.ux and u.uy are 0 and
|
* vision_recalc(2) -> newsym() -> crash! u.ux and u.uy are 0 and
|
||||||
* svp.program_state.panicking == 1 under those circumstances
|
* program_state.panicking == 1 under those circumstances
|
||||||
*/
|
*/
|
||||||
if (!svp.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. */
|
||||||
|
|||||||
+3
-3
@@ -1814,7 +1814,7 @@ add_menu_heading(winid tmpwin, const char *buf)
|
|||||||
color = iflags.menu_headings.color;
|
color = iflags.menu_headings.color;
|
||||||
|
|
||||||
/* suppress highlighting during end-of-game disclosure */
|
/* suppress highlighting during end-of-game disclosure */
|
||||||
if (svp.program_state.gameover)
|
if (program_state.gameover)
|
||||||
attr = ATR_NONE, color = NO_COLOR;
|
attr = ATR_NONE, color = NO_COLOR;
|
||||||
|
|
||||||
add_menu(tmpwin, &nul_glyphinfo, &any, '\0', '\0', attr, color,
|
add_menu(tmpwin, &nul_glyphinfo, &any, '\0', '\0', attr, color,
|
||||||
@@ -1862,10 +1862,10 @@ getlin(const char *query, char *bufp)
|
|||||||
{
|
{
|
||||||
boolean old_bot_disabled = gb.bot_disabled;
|
boolean old_bot_disabled = gb.bot_disabled;
|
||||||
|
|
||||||
svp.program_state.in_getlin = 1;
|
program_state.in_getlin = 1;
|
||||||
gb.bot_disabled = TRUE;
|
gb.bot_disabled = TRUE;
|
||||||
(*windowprocs.win_getlin)(query, bufp);
|
(*windowprocs.win_getlin)(query, bufp);
|
||||||
gb.bot_disabled = old_bot_disabled;
|
gb.bot_disabled = old_bot_disabled;
|
||||||
svp.program_state.in_getlin = 0;
|
program_state.in_getlin = 0;
|
||||||
}
|
}
|
||||||
/*windows.c*/
|
/*windows.c*/
|
||||||
|
|||||||
+2
-2
@@ -1435,7 +1435,7 @@ sanity_check(void)
|
|||||||
iflags.sanity_no_check = FALSE;
|
iflags.sanity_no_check = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
svp.program_state.in_sanity_check++;
|
program_state.in_sanity_check++;
|
||||||
you_sanity_check();
|
you_sanity_check();
|
||||||
obj_sanity_check();
|
obj_sanity_check();
|
||||||
timer_sanity_check();
|
timer_sanity_check();
|
||||||
@@ -1444,7 +1444,7 @@ sanity_check(void)
|
|||||||
bc_sanity_check();
|
bc_sanity_check();
|
||||||
trap_sanity_check();
|
trap_sanity_check();
|
||||||
engraving_sanity_check();
|
engraving_sanity_check();
|
||||||
svp.program_state.in_sanity_check--;
|
program_state.in_sanity_check--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* qsort() comparison routine for use in list_migrating_mons() */
|
/* qsort() comparison routine for use in list_migrating_mons() */
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ nhmain(int argc, char *argv[])
|
|||||||
* It seems you really want to play.
|
* It seems you really want to play.
|
||||||
*/
|
*/
|
||||||
u.uhp = 1; /* prevent RIP on early quits */
|
u.uhp = 1; /* prevent RIP on early quits */
|
||||||
svp.program_state.preserve_locks = 1;
|
program_state.preserve_locks = 1;
|
||||||
#ifndef NO_SIGNAL
|
#ifndef NO_SIGNAL
|
||||||
sethanguphandler((SIG_RET_TYPE) hangup);
|
sethanguphandler((SIG_RET_TYPE) hangup);
|
||||||
#endif
|
#endif
|
||||||
@@ -272,7 +272,7 @@ nhmain(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
if (*svp.plname) {
|
if (*svp.plname) {
|
||||||
getlock();
|
getlock();
|
||||||
svp.program_state.preserve_locks = 0; /* after getlock() */
|
program_state.preserve_locks = 0; /* after getlock() */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*svp.plname && (nhfp = restore_saved_game()) != 0) {
|
if (*svp.plname && (nhfp = restore_saved_game()) != 0) {
|
||||||
|
|||||||
+1
-1
@@ -794,7 +794,7 @@ vesa_cliparound(int x, int y)
|
|||||||
clipymax = ROWNO - 1;
|
clipymax = ROWNO - 1;
|
||||||
}
|
}
|
||||||
if (clipx != oldx || clipy != oldy) {
|
if (clipx != oldx || clipy != oldy) {
|
||||||
if (on_level(&u.uz0, &u.uz) && !svp.program_state.restoring)
|
if (on_level(&u.uz0, &u.uz) && !program_state.restoring)
|
||||||
/* (void) doredraw(); */
|
/* (void) doredraw(); */
|
||||||
vesa_redrawmap();
|
vesa_redrawmap();
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -472,7 +472,7 @@ vga_cliparound(int x, int y UNUSED)
|
|||||||
clipx = clipxmax - (viewport_size - 1);
|
clipx = clipxmax - (viewport_size - 1);
|
||||||
}
|
}
|
||||||
if (clipx != oldx) {
|
if (clipx != oldx) {
|
||||||
if (on_level(&u.uz0, &u.uz) && !svp.program_state.restoring)
|
if (on_level(&u.uz0, &u.uz) && !program_state.restoring)
|
||||||
/* (void) doredraw(); */
|
/* (void) doredraw(); */
|
||||||
vga_redrawmap(1);
|
vga_redrawmap(1);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -164,7 +164,7 @@ main(int argc, char *argv[])
|
|||||||
*/
|
*/
|
||||||
u.uhp = 1; /* prevent RIP on early quits */
|
u.uhp = 1; /* prevent RIP on early quits */
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
svp.program_state.preserve_locks = 1;
|
program_state.preserve_locks = 1;
|
||||||
#ifndef NO_SIGNAL
|
#ifndef NO_SIGNAL
|
||||||
sethanguphandler((SIG_RET_TYPE) hangup);
|
sethanguphandler((SIG_RET_TYPE) hangup);
|
||||||
#endif
|
#endif
|
||||||
@@ -239,7 +239,7 @@ main(int argc, char *argv[])
|
|||||||
if (*svp.plname) {
|
if (*svp.plname) {
|
||||||
getlock();
|
getlock();
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
svp.program_state.preserve_locks = 0; /* after getlock() */
|
program_state.preserve_locks = 0; /* after getlock() */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,8 +276,8 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (svp.program_state.in_self_recover) {
|
if (program_state.in_self_recover) {
|
||||||
svp.program_state.in_self_recover = FALSE;
|
program_state.in_self_recover = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -82,7 +82,7 @@ eraseoldlocks(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
svp.program_state.preserve_locks = 0; /* not required but shows intent */
|
program_state.preserve_locks = 0; /* not required but shows intent */
|
||||||
/* cannot use maxledgerno() here, because we need to find a lock name
|
/* cannot use maxledgerno() here, because we need to find a lock name
|
||||||
* before starting everything (including the dungeon initialization
|
* before starting everything (including the dungeon initialization
|
||||||
* that sets astral_level, needed for maxledgerno()) up
|
* that sets astral_level, needed for maxledgerno()) up
|
||||||
@@ -216,7 +216,7 @@ getlock(void)
|
|||||||
}
|
}
|
||||||
#ifdef SELF_RECOVER
|
#ifdef SELF_RECOVER
|
||||||
if (c == 'r' || c == 'R') {
|
if (c == 'r' || c == 'R') {
|
||||||
if (recover_savefile() && svp.program_state.in_self_recover) {
|
if (recover_savefile() && program_state.in_self_recover) {
|
||||||
set_levelfile_name(gl.lock, 0);
|
set_levelfile_name(gl.lock, 0);
|
||||||
fq_lock = fqname(gl.lock, LEVELPREFIX, 0);
|
fq_lock = fqname(gl.lock, LEVELPREFIX, 0);
|
||||||
goto gotlock;
|
goto gotlock;
|
||||||
|
|||||||
+3
-3
@@ -412,7 +412,7 @@ byebye(void)
|
|||||||
(void) sys$delprc(&mail_pid, (genericptr_t) 0), mail_pid = 0;
|
(void) sys$delprc(&mail_pid, (genericptr_t) 0), mail_pid = 0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef FREE_ALL_MEMORY
|
#ifdef FREE_ALL_MEMORY
|
||||||
if (progname && !svp.program_state.panicking) {
|
if (progname && !program_state.panicking) {
|
||||||
if (gh.hname == progname)
|
if (gh.hname == progname)
|
||||||
gh.hname = (char *) 0;
|
gh.hname = (char *) 0;
|
||||||
free((genericptr_t) progname), progname = (char *) 0;
|
free((genericptr_t) progname), progname = (char *) 0;
|
||||||
@@ -421,7 +421,7 @@ byebye(void)
|
|||||||
|
|
||||||
/* SIGHUP doesn't seem to do anything on VMS, so we fudge it here... */
|
/* SIGHUP doesn't seem to do anything on VMS, so we fudge it here... */
|
||||||
hup = (void (*)(int)) signal(SIGHUP, SIG_IGN);
|
hup = (void (*)(int)) signal(SIGHUP, SIG_IGN);
|
||||||
if (!svp.program_state.exiting++
|
if (!program_state.exiting++
|
||||||
&& hup != (void (*)(int)) SIG_DFL
|
&& hup != (void (*)(int)) SIG_DFL
|
||||||
&& hup != (void (*)(int)) SIG_IGN) {
|
&& hup != (void (*)(int)) SIG_IGN) {
|
||||||
(*hup)(SIGHUP);
|
(*hup)(SIGHUP);
|
||||||
@@ -446,7 +446,7 @@ genericptr_t mechargs) /* [0] is argc, [1..argc] are the real args */
|
|||||||
if (condition == SS$_ACCVIO /* access violation */
|
if (condition == SS$_ACCVIO /* access violation */
|
||||||
|| (condition >= SS$_ASTFLT && condition <= SS$_TBIT)
|
|| (condition >= SS$_ASTFLT && condition <= SS$_TBIT)
|
||||||
|| (condition >= SS$_ARTRES && condition <= SS$_INHCHME)) {
|
|| (condition >= SS$_ARTRES && condition <= SS$_INHCHME)) {
|
||||||
svp.program_state.done_hup = TRUE; /* pretend hangup has been attempted */
|
program_state.done_hup = TRUE; /* pretend hangup has been attempted */
|
||||||
#if (NH_DEVEL_STATUS == NH_STATUS_RELEASED)
|
#if (NH_DEVEL_STATUS == NH_STATUS_RELEASED)
|
||||||
if (wizard)
|
if (wizard)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -158,7 +158,7 @@ vms_getchar(void)
|
|||||||
static volatile int recurse = 0; /* SMG is not AST re-entrant! */
|
static volatile int recurse = 0; /* SMG is not AST re-entrant! */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (svp.program_state.done_hup) {
|
if (program_state.done_hup) {
|
||||||
/* hangup has occurred; do not attempt to get further user input */
|
/* hangup has occurred; do not attempt to get further user input */
|
||||||
return ESC;
|
return ESC;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -936,7 +936,7 @@ void buffer_fill_to_end(cell_t * buffer, cell_t * fill, int x, int y)
|
|||||||
while (dst != sentinel)
|
while (dst != sentinel)
|
||||||
*dst++ = *fill;
|
*dst++ = *fill;
|
||||||
|
|
||||||
if ((iflags.debug.immediateflips || !svp.program_state.in_moveloop)
|
if ((iflags.debug.immediateflips || !program_state.in_moveloop)
|
||||||
&& buffer == console.back_buffer)
|
&& buffer == console.back_buffer)
|
||||||
back_buffer_flip();
|
back_buffer_flip();
|
||||||
}
|
}
|
||||||
@@ -952,7 +952,7 @@ static void buffer_clear_to_end_of_line(cell_t * buffer, int x, int y)
|
|||||||
while (dst != sentinel)
|
while (dst != sentinel)
|
||||||
*dst++ = clear_cell;
|
*dst++ = clear_cell;
|
||||||
|
|
||||||
if (iflags.debug.immediateflips || !svp.program_state.in_moveloop)
|
if (iflags.debug.immediateflips || !program_state.in_moveloop)
|
||||||
back_buffer_flip();
|
back_buffer_flip();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -964,7 +964,7 @@ void buffer_write(cell_t * buffer, cell_t * cell, COORD pos)
|
|||||||
cell_t * dst = buffer + (console.width * pos.Y) + pos.X;
|
cell_t * dst = buffer + (console.width * pos.Y) + pos.X;
|
||||||
*dst = *cell;
|
*dst = *cell;
|
||||||
|
|
||||||
if ((iflags.debug.immediateflips || !svp.program_state.in_moveloop)
|
if ((iflags.debug.immediateflips || !program_state.in_moveloop)
|
||||||
&& buffer == console.back_buffer)
|
&& buffer == console.back_buffer)
|
||||||
back_buffer_flip();
|
back_buffer_flip();
|
||||||
}
|
}
|
||||||
@@ -1149,7 +1149,7 @@ tgetch(void)
|
|||||||
numpad |= 0x10;
|
numpad |= 0x10;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (svp.program_state.done_hup)
|
return (program_state.done_hup)
|
||||||
? '\033'
|
? '\033'
|
||||||
: keyboard_handling.pCheckInput(
|
: keyboard_handling.pCheckInput(
|
||||||
console.hConIn, &ir, &count, numpad, 0, &mod, &cc);
|
console.hConIn, &ir, &count, numpad, 0, &mod, &cc);
|
||||||
@@ -1177,7 +1177,7 @@ console_poskey(coordxy *x, coordxy *y, int *mod)
|
|||||||
if (gc.Cmd.swap_yz)
|
if (gc.Cmd.swap_yz)
|
||||||
numpad |= 0x10;
|
numpad |= 0x10;
|
||||||
#endif
|
#endif
|
||||||
ch = (svp.program_state.done_hup)
|
ch = (program_state.done_hup)
|
||||||
? '\033'
|
? '\033'
|
||||||
: keyboard_handling.pCheckInput(
|
: keyboard_handling.pCheckInput(
|
||||||
console.hConIn, &ir, &count, numpad, 1, mod, &cc);
|
console.hConIn, &ir, &count, numpad, 1, mod, &cc);
|
||||||
|
|||||||
@@ -771,8 +771,8 @@ attempt_restore:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (svp.program_state.in_self_recover) {
|
if (program_state.in_self_recover) {
|
||||||
svp.program_state.in_self_recover = FALSE;
|
program_state.in_self_recover = FALSE;
|
||||||
set_savefile_name(TRUE);
|
set_savefile_name(TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -498,7 +498,7 @@ void NetHackQtBind::qt_update_inventory(int arg UNUSED)
|
|||||||
main->updateInventory(); // update the paper doll inventory subset
|
main->updateInventory(); // update the paper doll inventory subset
|
||||||
|
|
||||||
/* doesn't work yet
|
/* doesn't work yet
|
||||||
if (svp.program_state.something_worth_saving && iflags.perm_invent)
|
if (program_state.something_worth_saving && iflags.perm_invent)
|
||||||
display_inventory(NULL, false);
|
display_inventory(NULL, false);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@@ -667,7 +667,7 @@ char NetHackQtBind::qt_more()
|
|||||||
// ^C comment in that routine] when the core triggers --More-- via
|
// ^C comment in that routine] when the core triggers --More-- via
|
||||||
// done2() -> really_done() -> display_nhwindow(WIN_MESSAGE, TRUE)
|
// done2() -> really_done() -> display_nhwindow(WIN_MESSAGE, TRUE)
|
||||||
// (get rid of this if the exec() loop issue gets properly fixed)
|
// (get rid of this if the exec() loop issue gets properly fixed)
|
||||||
if (::svp.program_state.gameover)
|
if (::program_state.gameover)
|
||||||
return ch; // bypass --More-- and just continue with program exit
|
return ch; // bypass --More-- and just continue with program exit
|
||||||
|
|
||||||
NetHackQtMessageWindow *mesgwin = main ? main->GetMessageWindow() : NULL;
|
NetHackQtMessageWindow *mesgwin = main ? main->GetMessageWindow() : NULL;
|
||||||
|
|||||||
+5
-5
@@ -1015,7 +1015,7 @@ bool NetHackQtMainWindow::ok_for_command()
|
|||||||
* FIXME: it would be much better to gray-out inapplicable entries
|
* FIXME: it would be much better to gray-out inapplicable entries
|
||||||
* when popping up a command menu instead of needing this.
|
* when popping up a command menu instead of needing this.
|
||||||
*/
|
*/
|
||||||
if (::svp.program_state.input_state != commandInp) {
|
if (::program_state.input_state != commandInp) {
|
||||||
NetHackQtBind::qt_nhbell();
|
NetHackQtBind::qt_nhbell();
|
||||||
// possibly call doKeys("\033"); here?
|
// possibly call doKeys("\033"); here?
|
||||||
return false;
|
return false;
|
||||||
@@ -1059,7 +1059,7 @@ void NetHackQtMainWindow::doQuit(bool)
|
|||||||
// in case someone wants to change that
|
// in case someone wants to change that
|
||||||
#ifdef MACOS
|
#ifdef MACOS
|
||||||
QString info = nh_qsprintf("This will end your NetHack session.%s",
|
QString info = nh_qsprintf("This will end your NetHack session.%s",
|
||||||
!svp.program_state.something_worth_saving ? ""
|
!program_state.something_worth_saving ? ""
|
||||||
: "\n(Cancel quitting and use the Save command"
|
: "\n(Cancel quitting and use the Save command"
|
||||||
"\nto save your current game.)");
|
"\nto save your current game.)");
|
||||||
/* this is similar to closeEvent but the details are different;
|
/* this is similar to closeEvent but the details are different;
|
||||||
@@ -1077,7 +1077,7 @@ void NetHackQtMainWindow::doQuit(bool)
|
|||||||
break; // return to game
|
break; // return to game
|
||||||
case 1:
|
case 1:
|
||||||
// quit -- bypass the prompting preformed by done2()
|
// quit -- bypass the prompting preformed by done2()
|
||||||
svp.program_state.stopprint++;
|
program_state.stopprint++;
|
||||||
::done(QUIT);
|
::done(QUIT);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
break;
|
break;
|
||||||
@@ -1406,7 +1406,7 @@ void NetHackQtMainWindow::keyPressEvent(QKeyEvent* event)
|
|||||||
void NetHackQtMainWindow::closeEvent(QCloseEvent *e UNUSED)
|
void NetHackQtMainWindow::closeEvent(QCloseEvent *e UNUSED)
|
||||||
{
|
{
|
||||||
int ok = 0;
|
int ok = 0;
|
||||||
if ( svp.program_state.something_worth_saving ) {
|
if ( program_state.something_worth_saving ) {
|
||||||
/* this used to offer "Save" and "Cancel"
|
/* this used to offer "Save" and "Cancel"
|
||||||
but cancel (ignoring the close attempt) won't work
|
but cancel (ignoring the close attempt) won't work
|
||||||
if user has clicked on the window's Close button */
|
if user has clicked on the window's Close button */
|
||||||
@@ -1421,7 +1421,7 @@ void NetHackQtMainWindow::closeEvent(QCloseEvent *e UNUSED)
|
|||||||
case 1:
|
case 1:
|
||||||
// quit -- bypass the prompting preformed by done2()
|
// quit -- bypass the prompting preformed by done2()
|
||||||
ok = 1;
|
ok = 1;
|
||||||
svp.program_state.stopprint++;
|
program_state.stopprint++;
|
||||||
::done(QUIT);
|
::done(QUIT);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
break;
|
break;
|
||||||
|
|||||||
+1
-1
@@ -220,7 +220,7 @@ char NetHackQtYnDialog::Exec()
|
|||||||
// for "ynaq" (where "all" is a choice) it's "stop"
|
// for "ynaq" (where "all" is a choice) it's "stop"
|
||||||
// and for end of game disclosure it really is "quit"
|
// and for end of game disclosure it really is "quit"
|
||||||
if (question.left(10) == QString("Dump core?")
|
if (question.left(10) == QString("Dump core?")
|
||||||
|| (::svp.program_state.gameover
|
|| (::program_state.gameover
|
||||||
&& question.left(11) == QString("Do you want")))
|
&& question.left(11) == QString("Do you want")))
|
||||||
button_name = "Quit";
|
button_name = "Quit";
|
||||||
else if (is_ynaq)
|
else if (is_ynaq)
|
||||||
|
|||||||
+3
-3
@@ -1282,7 +1282,7 @@ X11_update_inventory(int arg)
|
|||||||
|
|
||||||
if (iflags.perm_invent) {
|
if (iflags.perm_invent) {
|
||||||
/* skip any calls to update_inventory() before in_moveloop starts */
|
/* skip any calls to update_inventory() before in_moveloop starts */
|
||||||
if (svp.program_state.in_moveloop || svp.program_state.gameover) {
|
if (program_state.in_moveloop || program_state.gameover) {
|
||||||
updated_inventory = 1; /* hack to avoid mapping&raising window */
|
updated_inventory = 1; /* hack to avoid mapping&raising window */
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
(void) display_inventory((char *) 0, FALSE);
|
(void) display_inventory((char *) 0, FALSE);
|
||||||
@@ -1798,7 +1798,7 @@ X11_hangup(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
static void
|
static void
|
||||||
X11_bail(const char *mesg)
|
X11_bail(const char *mesg)
|
||||||
{
|
{
|
||||||
svp.program_state.something_worth_saving = 0;
|
program_state.something_worth_saving = 0;
|
||||||
clearlocks();
|
clearlocks();
|
||||||
X11_exit_nhwindows(mesg);
|
X11_exit_nhwindows(mesg);
|
||||||
nh_terminate(EXIT_SUCCESS);
|
nh_terminate(EXIT_SUCCESS);
|
||||||
@@ -2041,7 +2041,7 @@ X11_getlin(
|
|||||||
/* we get here after the popup has exited;
|
/* we get here after the popup has exited;
|
||||||
put prompt and response into the message window (and into
|
put prompt and response into the message window (and into
|
||||||
core's dumplog history) unless play hasn't started yet */
|
core's dumplog history) unless play hasn't started yet */
|
||||||
if (svp.program_state.in_moveloop || svp.program_state.gameover) {
|
if (program_state.in_moveloop || program_state.gameover) {
|
||||||
/* single space has meaning (to remove a previously applied name) so
|
/* single space has meaning (to remove a previously applied name) so
|
||||||
show it clearly; don't care about legibility of multiple spaces */
|
show it clearly; don't care about legibility of multiple spaces */
|
||||||
const char *visanswer = !input[0] ? "<empty>"
|
const char *visanswer = !input[0] ? "<empty>"
|
||||||
|
|||||||
+2
-2
@@ -1988,7 +1988,7 @@ x_event(int exit_condition)
|
|||||||
/* pkey(retval); */
|
/* pkey(retval); */
|
||||||
keep_going = FALSE;
|
keep_going = FALSE;
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
} else if (svp.program_state.done_hup) {
|
} else if (program_state.done_hup) {
|
||||||
retval = '\033';
|
retval = '\033';
|
||||||
inptr = (inptr + 1) % INBUF_SIZE;
|
inptr = (inptr + 1) % INBUF_SIZE;
|
||||||
keep_going = FALSE;
|
keep_going = FALSE;
|
||||||
@@ -2009,7 +2009,7 @@ x_event(int exit_condition)
|
|||||||
}
|
}
|
||||||
keep_going = FALSE;
|
keep_going = FALSE;
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
} else if (svp.program_state.done_hup) {
|
} else if (program_state.done_hup) {
|
||||||
retval = '\033';
|
retval = '\033';
|
||||||
inptr = (inptr + 1) % INBUF_SIZE;
|
inptr = (inptr + 1) % INBUF_SIZE;
|
||||||
keep_going = FALSE;
|
keep_going = FALSE;
|
||||||
|
|||||||
+5
-5
@@ -1222,7 +1222,7 @@ X11_player_selection_dialog(void)
|
|||||||
|
|
||||||
if (ps_selected == PS_QUIT
|
if (ps_selected == PS_QUIT
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
|| svp.program_state.done_hup
|
|| program_state.done_hup
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
clearlocks();
|
clearlocks();
|
||||||
@@ -1300,7 +1300,7 @@ X11_player_selection_prompts(void)
|
|||||||
|
|
||||||
if (ps_selected == PS_QUIT
|
if (ps_selected == PS_QUIT
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
|| svp.program_state.done_hup
|
|| program_state.done_hup
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
clearlocks();
|
clearlocks();
|
||||||
@@ -1373,7 +1373,7 @@ X11_player_selection_prompts(void)
|
|||||||
|
|
||||||
if (ps_selected == PS_QUIT
|
if (ps_selected == PS_QUIT
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
|| svp.program_state.done_hup
|
|| program_state.done_hup
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
clearlocks();
|
clearlocks();
|
||||||
@@ -1445,7 +1445,7 @@ X11_player_selection_prompts(void)
|
|||||||
|
|
||||||
if (ps_selected == PS_QUIT
|
if (ps_selected == PS_QUIT
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
|| svp.program_state.done_hup
|
|| program_state.done_hup
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
clearlocks();
|
clearlocks();
|
||||||
@@ -1515,7 +1515,7 @@ X11_player_selection_prompts(void)
|
|||||||
|
|
||||||
if (ps_selected == PS_QUIT
|
if (ps_selected == PS_QUIT
|
||||||
#if defined(HANGUPHANDLING)
|
#if defined(HANGUPHANDLING)
|
||||||
|| svp.program_state.done_hup
|
|| program_state.done_hup
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
clearlocks();
|
clearlocks();
|
||||||
|
|||||||
@@ -789,7 +789,7 @@ curses_display_nhmenu(
|
|||||||
menu_determine_pages(current_menu);
|
menu_determine_pages(current_menu);
|
||||||
|
|
||||||
/* Display pre and post-game menus centered */
|
/* Display pre and post-game menus centered */
|
||||||
if ((svm.moves <= 1 && !gi.invent) || svp.program_state.gameover) {
|
if ((svm.moves <= 1 && !gi.invent) || program_state.gameover) {
|
||||||
win = curses_create_window(wid, current_menu->width,
|
win = curses_create_window(wid, current_menu->width,
|
||||||
current_menu->height, CENTER);
|
current_menu->height, CENTER);
|
||||||
} else { /* Display during-game menus on the right out of the way */
|
} else { /* Display during-game menus on the right out of the way */
|
||||||
@@ -1033,7 +1033,7 @@ menu_win_size(nhmenu *menu)
|
|||||||
int maxheaderwidth = menu->prompt ? (int) strlen(menu->prompt) : 0;
|
int maxheaderwidth = menu->prompt ? (int) strlen(menu->prompt) : 0;
|
||||||
nhmenu_item *menu_item_ptr, *last_item_ptr = NULL;
|
nhmenu_item *menu_item_ptr, *last_item_ptr = NULL;
|
||||||
|
|
||||||
if (svp.program_state.gameover) {
|
if (program_state.gameover) {
|
||||||
/* for final inventory disclosure, use full width */
|
/* for final inventory disclosure, use full width */
|
||||||
maxwidth = term_cols - 2; /* +2: borders assumed */
|
maxwidth = term_cols - 2; /* +2: borders assumed */
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -782,7 +782,7 @@ curses_update_inventory(int arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* skip inventory updating during character initialization */
|
/* skip inventory updating during character initialization */
|
||||||
if (!svp.program_state.in_moveloop && !svp.program_state.gameover)
|
if (!program_state.in_moveloop && !program_state.gameover)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
|
|||||||
@@ -776,7 +776,7 @@ Currently this is limited to arrow keys, but this may be expanded. */
|
|||||||
int
|
int
|
||||||
curses_convert_keys(int key)
|
curses_convert_keys(int key)
|
||||||
{
|
{
|
||||||
boolean reject = (svp.program_state.input_state == otherInp),
|
boolean reject = (program_state.input_state == otherInp),
|
||||||
as_is = FALSE, numpad_esc = FALSE;
|
as_is = FALSE, numpad_esc = FALSE;
|
||||||
int ret = key;
|
int ret = key;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -232,7 +232,7 @@ xwaitforspace(const char *s) /* chars allowed besides return */
|
|||||||
morc = 0;
|
morc = 0;
|
||||||
while (
|
while (
|
||||||
#ifdef HANGUPHANDLING
|
#ifdef HANGUPHANDLING
|
||||||
!svp.program_state.done_hup &&
|
!program_state.done_hup &&
|
||||||
#endif
|
#endif
|
||||||
(c = tty_nhgetch()) != EOF) {
|
(c = tty_nhgetch()) != EOF) {
|
||||||
if (c == '\n' || c == '\r')
|
if (c == '\n' || c == '\r')
|
||||||
|
|||||||
+1
-1
@@ -184,7 +184,7 @@ remember_topl(void)
|
|||||||
cw->datlen[idx] = (short) len;
|
cw->datlen[idx] = (short) len;
|
||||||
}
|
}
|
||||||
Strcpy(cw->data[idx], gt.toplines);
|
Strcpy(cw->data[idx], gt.toplines);
|
||||||
if (!svp.program_state.in_checkpoint) {
|
if (!program_state.in_checkpoint) {
|
||||||
*gt.toplines = '\0';
|
*gt.toplines = '\0';
|
||||||
cw->maxcol = cw->maxrow = (idx + 1) % cw->rows;
|
cw->maxcol = cw->maxrow = (idx + 1) % cw->rows;
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-14
@@ -84,7 +84,7 @@ extern void msmsg(const char *, ...);
|
|||||||
*/
|
*/
|
||||||
#define HUPSKIP() \
|
#define HUPSKIP() \
|
||||||
do { \
|
do { \
|
||||||
if (svp.program_state.done_hup) { \
|
if (program_state.done_hup) { \
|
||||||
morc = '\033'; \
|
morc = '\033'; \
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
@@ -92,7 +92,7 @@ extern void msmsg(const char *, ...);
|
|||||||
/* morc=ESC - in case we bypass xwaitforspace() which sets that */
|
/* morc=ESC - in case we bypass xwaitforspace() which sets that */
|
||||||
#define HUPSKIP_RESULT(RES) \
|
#define HUPSKIP_RESULT(RES) \
|
||||||
do { \
|
do { \
|
||||||
if (svp.program_state.done_hup) \
|
if (program_state.done_hup) \
|
||||||
return (RES); \
|
return (RES); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#else /* !HANGUPHANDLING */
|
#else /* !HANGUPHANDLING */
|
||||||
@@ -376,11 +376,11 @@ winch_handler(int sig_unused UNUSED)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
svp.program_state.resize_pending++; /* resize_tty() will reset it */
|
program_state.resize_pending++; /* resize_tty() will reset it */
|
||||||
/* if nethack is waiting for input, which is the most likely scenario,
|
/* if nethack is waiting for input, which is the most likely scenario,
|
||||||
we will go ahead and respond to the resize immediately; otherwise,
|
we will go ahead and respond to the resize immediately; otherwise,
|
||||||
tty_nhgetch() will do so the next time it's called */
|
tty_nhgetch() will do so the next time it's called */
|
||||||
if (svp.program_state.getting_char) {
|
if (program_state.getting_char) {
|
||||||
resize_tty();
|
resize_tty();
|
||||||
#if 0 /* [this doesn't work as intended and seems to be unnecessary] */
|
#if 0 /* [this doesn't work as intended and seems to be unnecessary] */
|
||||||
if (resize_mesg) {
|
if (resize_mesg) {
|
||||||
@@ -402,7 +402,7 @@ resize_tty(void)
|
|||||||
struct WinDesc *cw;
|
struct WinDesc *cw;
|
||||||
|
|
||||||
/* reset to 0 rather than just decrement */
|
/* reset to 0 rather than just decrement */
|
||||||
svp.program_state.resize_pending = 0;
|
program_state.resize_pending = 0;
|
||||||
resize_mesg = 0;
|
resize_mesg = 0;
|
||||||
|
|
||||||
getwindowsz(); /* update LI and CO */
|
getwindowsz(); /* update LI and CO */
|
||||||
@@ -1978,7 +1978,7 @@ tty_dismiss_nhwindow(winid window)
|
|||||||
can't refresh--force the screen to be cleared instead
|
can't refresh--force the screen to be cleared instead
|
||||||
(affects dismissal of 'reset role filtering' menu if
|
(affects dismissal of 'reset role filtering' menu if
|
||||||
screen height forces that to need a second page) */
|
screen height forces that to need a second page) */
|
||||||
if (svp.program_state.in_role_selection)
|
if (program_state.in_role_selection)
|
||||||
clearscreen = TRUE;
|
clearscreen = TRUE;
|
||||||
|
|
||||||
erase_menu_or_text(window, cw, clearscreen);
|
erase_menu_or_text(window, cw, clearscreen);
|
||||||
@@ -3041,7 +3041,7 @@ ttyinv_add_menu(
|
|||||||
: !show_gold ? 26
|
: !show_gold ? 26
|
||||||
: 27);
|
: 27);
|
||||||
|
|
||||||
if (!svp.program_state.in_moveloop)
|
if (!program_state.in_moveloop)
|
||||||
return;
|
return;
|
||||||
slot = selector_to_slot(ch, ttyinvmode, &ignore);
|
slot = selector_to_slot(ch, ttyinvmode, &ignore);
|
||||||
if (inuse_only && slot > 2 * rows_per_side)
|
if (inuse_only && slot > 2 * rows_per_side)
|
||||||
@@ -3216,7 +3216,7 @@ ttyinv_end_menu(int window, struct WinDesc *cw)
|
|||||||
{
|
{
|
||||||
if (iflags.perm_invent
|
if (iflags.perm_invent
|
||||||
|| gp.perm_invent_toggling_direction == toggling_on) {
|
|| gp.perm_invent_toggling_direction == toggling_on) {
|
||||||
if (svp.program_state.in_moveloop) {
|
if (program_state.in_moveloop) {
|
||||||
boolean inuse_only = ((ttyinvmode & InvInUse) != 0);
|
boolean inuse_only = ((ttyinvmode & InvInUse) != 0);
|
||||||
int rows_per_side = inuse_only ? cw->maxrow - 2 : 0;
|
int rows_per_side = inuse_only ? cw->maxrow - 2 : 0;
|
||||||
int old_slots_used = ttyinv_slots_used; /* value before render */
|
int old_slots_used = ttyinv_slots_used; /* value before render */
|
||||||
@@ -3245,7 +3245,7 @@ ttyinv_render(winid window, struct WinDesc *cw)
|
|||||||
uint32 current_row_color = NO_COLOR;
|
uint32 current_row_color = NO_COLOR;
|
||||||
struct tty_perminvent_cell *cell;
|
struct tty_perminvent_cell *cell;
|
||||||
char invbuf[BUFSZ];
|
char invbuf[BUFSZ];
|
||||||
boolean force_redraw = svp.program_state.in_docrt ? TRUE : FALSE,
|
boolean force_redraw = program_state.in_docrt ? TRUE : FALSE,
|
||||||
inuse_only = (ttyinvmode & InvInUse) != 0,
|
inuse_only = (ttyinvmode & InvInUse) != 0,
|
||||||
show_gold = (ttyinvmode & InvShowGold) != 0 && !inuse_only,
|
show_gold = (ttyinvmode & InvShowGold) != 0 && !inuse_only,
|
||||||
sparse = (ttyinvmode & InvSparse) != 0 && !inuse_only;
|
sparse = (ttyinvmode & InvSparse) != 0 && !inuse_only;
|
||||||
@@ -3603,7 +3603,7 @@ tty_wait_synch(void)
|
|||||||
if (ttyDisplay->inmore) {
|
if (ttyDisplay->inmore) {
|
||||||
addtopl("--More--");
|
addtopl("--More--");
|
||||||
(void) fflush(stdout);
|
(void) fflush(stdout);
|
||||||
} else if (ttyDisplay->inread > svp.program_state.gameover) {
|
} else if (ttyDisplay->inread > program_state.gameover) {
|
||||||
/* this can only happen if we were reading and got interrupted */
|
/* this can only happen if we were reading and got interrupted */
|
||||||
ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT;
|
ttyDisplay->toplin = TOPLINE_SPECIAL_PROMPT;
|
||||||
/* do this twice; 1st time gets the Quit? message again */
|
/* do this twice; 1st time gets the Quit? message again */
|
||||||
@@ -4036,19 +4036,19 @@ tty_nhgetch(void)
|
|||||||
i = randomkey();
|
i = randomkey();
|
||||||
} else {
|
} else {
|
||||||
#ifdef RESIZABLE
|
#ifdef RESIZABLE
|
||||||
if (svp.program_state.resize_pending)
|
if (program_state.resize_pending)
|
||||||
resize_tty();
|
resize_tty();
|
||||||
#endif
|
#endif
|
||||||
svp.program_state.getting_char++;
|
program_state.getting_char++;
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
i = (svp.program_state.getting_char == 1)
|
i = (program_state.getting_char == 1)
|
||||||
? tgetch()
|
? tgetch()
|
||||||
: ((read(fileno(stdin), (genericptr_t) &nestbuf, 1) == 1)
|
: ((read(fileno(stdin), (genericptr_t) &nestbuf, 1) == 1)
|
||||||
? (int) nestbuf : EOF);
|
? (int) nestbuf : EOF);
|
||||||
#else
|
#else
|
||||||
i = tgetch();
|
i = tgetch();
|
||||||
#endif
|
#endif
|
||||||
svp.program_state.getting_char--;
|
program_state.getting_char--;
|
||||||
#ifdef RESIZABLE
|
#ifdef RESIZABLE
|
||||||
if (resize_mesg) {
|
if (resize_mesg) {
|
||||||
resize_mesg = 0;
|
resize_mesg = 0;
|
||||||
|
|||||||
+3
-3
@@ -39,7 +39,7 @@ mswin_have_input(void)
|
|||||||
return
|
return
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
/* we always have input (ESC) if hangup was requested */
|
/* we always have input (ESC) if hangup was requested */
|
||||||
svp.program_state.done_hup ||
|
program_state.done_hup ||
|
||||||
#endif
|
#endif
|
||||||
(nhi_read_pos != nhi_write_pos);
|
(nhi_read_pos != nhi_write_pos);
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ mswin_input_pop(void)
|
|||||||
|
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
/* always return ESC when hangup was requested */
|
/* always return ESC when hangup was requested */
|
||||||
if (svp.program_state.done_hup) {
|
if (program_state.done_hup) {
|
||||||
static MSNHEvent hangup_event;
|
static MSNHEvent hangup_event;
|
||||||
hangup_event.type = NHEVENT_CHAR;
|
hangup_event.type = NHEVENT_CHAR;
|
||||||
hangup_event.ei.kbd.ch = '\033';
|
hangup_event.ei.kbd.ch = '\033';
|
||||||
@@ -98,7 +98,7 @@ mswin_input_peek(void)
|
|||||||
|
|
||||||
#ifdef SAFERHANGUP
|
#ifdef SAFERHANGUP
|
||||||
/* always return ESC when hangup was requested */
|
/* always return ESC when hangup was requested */
|
||||||
if (svp.program_state.done_hup) {
|
if (program_state.done_hup) {
|
||||||
static MSNHEvent hangup_event;
|
static MSNHEvent hangup_event;
|
||||||
hangup_event.type = NHEVENT_CHAR;
|
hangup_event.type = NHEVENT_CHAR;
|
||||||
hangup_event.ei.kbd.ch = '\033';
|
hangup_event.ei.kbd.ch = '\033';
|
||||||
|
|||||||
+4
-4
@@ -457,16 +457,16 @@ MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
case WM_CLOSE: {
|
case WM_CLOSE: {
|
||||||
/* exit gracefully */
|
/* exit gracefully */
|
||||||
if (svp.program_state.gameover) {
|
if (program_state.gameover) {
|
||||||
/* assume the user really meant this, as the game is already
|
/* assume the user really meant this, as the game is already
|
||||||
* over... */
|
* over... */
|
||||||
/* to make sure we still save bones, just set stop printing flag
|
/* to make sure we still save bones, just set stop printing flag
|
||||||
*/
|
*/
|
||||||
svp.program_state.stopprint++;
|
program_state.stopprint++;
|
||||||
NHEVENT_KBD(
|
NHEVENT_KBD(
|
||||||
'\033'); /* and send keyboard input as if user pressed ESC */
|
'\033'); /* and send keyboard input as if user pressed ESC */
|
||||||
/* additional code for this is done in menu and rip windows */
|
/* additional code for this is done in menu and rip windows */
|
||||||
} else if (!svp.program_state.something_worth_saving) {
|
} else if (!program_state.something_worth_saving) {
|
||||||
/* User exited before the game started, e.g. during splash display
|
/* User exited before the game started, e.g. during splash display
|
||||||
*/
|
*/
|
||||||
/* Just get out. */
|
/* Just get out. */
|
||||||
@@ -842,7 +842,7 @@ onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
|||||||
case IDM_SAVE:
|
case IDM_SAVE:
|
||||||
if (iflags.debug_fuzzer)
|
if (iflags.debug_fuzzer)
|
||||||
break;
|
break;
|
||||||
if (!svp.program_state.gameover && !svp.program_state.done_hup)
|
if (!program_state.gameover && !program_state.done_hup)
|
||||||
dosave();
|
dosave();
|
||||||
else
|
else
|
||||||
MessageBeep(0);
|
MessageBeep(0);
|
||||||
|
|||||||
+2
-2
@@ -351,10 +351,10 @@ MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
if (svp.program_state.gameover) {
|
if (program_state.gameover) {
|
||||||
data->result = -1;
|
data->result = -1;
|
||||||
data->done = 1;
|
data->done = 1;
|
||||||
svp.program_state.stopprint++;
|
program_state.stopprint++;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else
|
} else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
+1
-1
@@ -227,7 +227,7 @@ NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
GetNHApp()->hMainWnd = NULL;
|
GetNHApp()->hMainWnd = NULL;
|
||||||
DestroyWindow(hWnd);
|
DestroyWindow(hWnd);
|
||||||
SetFocus(GetNHApp()->hMainWnd);
|
SetFocus(GetNHApp()->hMainWnd);
|
||||||
svp.program_state.stopprint++;
|
program_state.stopprint++;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
|
|||||||
+2
-2
@@ -1251,7 +1251,7 @@ void
|
|||||||
mswin_update_inventory(int arg)
|
mswin_update_inventory(int arg)
|
||||||
{
|
{
|
||||||
logDebug("mswin_update_inventory(%d)\n", arg);
|
logDebug("mswin_update_inventory(%d)\n", arg);
|
||||||
if (iflags.perm_invent && svp.program_state.something_worth_saving
|
if (iflags.perm_invent && program_state.something_worth_saving
|
||||||
&& iflags.window_inited && WIN_INVEN != WIN_ERR)
|
&& iflags.window_inited && WIN_INVEN != WIN_ERR)
|
||||||
display_inventory(NULL, FALSE);
|
display_inventory(NULL, FALSE);
|
||||||
}
|
}
|
||||||
@@ -2862,7 +2862,7 @@ int
|
|||||||
NHMessageBox(HWND hWnd, LPCTSTR text, UINT type)
|
NHMessageBox(HWND hWnd, LPCTSTR text, UINT type)
|
||||||
{
|
{
|
||||||
TCHAR title[MAX_LOADSTRING];
|
TCHAR title[MAX_LOADSTRING];
|
||||||
if (svp.program_state.exiting && !strcmp(text, "\n"))
|
if (program_state.exiting && !strcmp(text, "\n"))
|
||||||
text = "Press Enter to exit";
|
text = "Press Enter to exit";
|
||||||
|
|
||||||
LoadString(GetNHApp()->hApp, IDS_APP_TITLE_SHORT, title, MAX_LOADSTRING);
|
LoadString(GetNHApp()->hApp, IDS_APP_TITLE_SHORT, title, MAX_LOADSTRING);
|
||||||
|
|||||||
Reference in New Issue
Block a user