program_state moved to g.
This commit is contained in:
+3
-2
@@ -98,7 +98,7 @@ E NEARDATA char tune[6];
|
||||
|
||||
#define MAXLINFO (MAXDUNGEON * MAXLEVEL)
|
||||
|
||||
E NEARDATA struct sinfo {
|
||||
struct sinfo {
|
||||
int gameover; /* self explanatory? */
|
||||
int stopprint; /* inhibit further end of game disclosure */
|
||||
#ifdef HANGUPHANDLING
|
||||
@@ -115,7 +115,7 @@ E NEARDATA struct sinfo {
|
||||
int in_paniclog;
|
||||
#endif
|
||||
int wizkit_wishing;
|
||||
} program_state;
|
||||
};
|
||||
|
||||
E const char quitchars[];
|
||||
E const char vowels[];
|
||||
@@ -713,6 +713,7 @@ struct instance_globals {
|
||||
const char *alllevels = "levels.*";
|
||||
const char *allbones = "bones*.*";
|
||||
#endif
|
||||
struct sinfo program_state;
|
||||
|
||||
/* dig.c */
|
||||
|
||||
|
||||
+3
-3
@@ -72,10 +72,10 @@ boolean resuming;
|
||||
g.youmonst.movement = NORMAL_SPEED; /* give the hero some movement points */
|
||||
g.context.move = 0;
|
||||
|
||||
program_state.in_moveloop = 1;
|
||||
g.program_state.in_moveloop = 1;
|
||||
for (;;) {
|
||||
#ifdef SAFERHANGUP
|
||||
if (program_state.done_hup)
|
||||
if (g.program_state.done_hup)
|
||||
end_of_input();
|
||||
#endif
|
||||
get_nh_event();
|
||||
@@ -623,7 +623,7 @@ newgame()
|
||||
#ifdef INSURANCE
|
||||
save_currentstate();
|
||||
#endif
|
||||
program_state.something_worth_saving++; /* useful data now exists */
|
||||
g.program_state.something_worth_saving++; /* useful data now exists */
|
||||
|
||||
/* Success! */
|
||||
welcome(TRUE);
|
||||
|
||||
@@ -4475,7 +4475,7 @@ register char *cmd;
|
||||
|
||||
iflags.menu_requested = FALSE;
|
||||
#ifdef SAFERHANGUP
|
||||
if (program_state.done_hup)
|
||||
if (g.program_state.done_hup)
|
||||
end_of_input();
|
||||
#endif
|
||||
if (firsttime) {
|
||||
@@ -5612,8 +5612,8 @@ void
|
||||
hangup(sig_unused) /* called as signal() handler, so sent at least one arg */
|
||||
int sig_unused UNUSED;
|
||||
{
|
||||
if (program_state.exiting)
|
||||
program_state.in_moveloop = 0;
|
||||
if (g.program_state.exiting)
|
||||
g.program_state.in_moveloop = 0;
|
||||
nhwindows_hangup();
|
||||
#ifdef SAFERHANGUP
|
||||
/* When using SAFERHANGUP, the done_hup flag it tested in rhack
|
||||
@@ -5622,9 +5622,9 @@ int sig_unused UNUSED;
|
||||
protects against losing objects in the process of being thrown,
|
||||
but also potentially riskier because the disconnected program
|
||||
must continue running longer before attempting a hangup save. */
|
||||
program_state.done_hup++;
|
||||
g.program_state.done_hup++;
|
||||
/* defer hangup iff game appears to be in progress */
|
||||
if (program_state.in_moveloop && program_state.something_worth_saving)
|
||||
if (g.program_state.in_moveloop && g.program_state.something_worth_saving)
|
||||
return;
|
||||
#endif /* SAFERHANGUP */
|
||||
end_of_input();
|
||||
@@ -5635,16 +5635,16 @@ end_of_input()
|
||||
{
|
||||
#ifdef NOSAVEONHANGUP
|
||||
#ifdef INSURANCE
|
||||
if (flags.ins_chkpt && program_state.something_worth_saving)
|
||||
if (flags.ins_chkpt && g.program_state.something_worth_saving)
|
||||
program_statue.preserve_locks = 1; /* keep files for recovery */
|
||||
#endif
|
||||
program_state.something_worth_saving = 0; /* don't save */
|
||||
g.program_state.something_worth_saving = 0; /* don't save */
|
||||
#endif
|
||||
|
||||
#ifndef SAFERHANGUP
|
||||
if (!program_state.done_hup++)
|
||||
if (!g.program_state.done_hup++)
|
||||
#endif
|
||||
if (program_state.something_worth_saving)
|
||||
if (g.program_state.something_worth_saving)
|
||||
(void) dosave0();
|
||||
if (iflags.window_inited)
|
||||
exit_nhwindows((char *) 0);
|
||||
|
||||
+5
-7
@@ -5,8 +5,6 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
/* from xxxmain.c */
|
||||
|
||||
const char quitchars[] = " \r\n\033";
|
||||
const char vowels[] = "aeiouAEIOU";
|
||||
const char ynchars[] = "yn";
|
||||
@@ -17,8 +15,6 @@ NEARDATA long yn_number = 0L;
|
||||
|
||||
const char disclosure_options[] = "iavgco";
|
||||
|
||||
NEARDATA struct sinfo program_state;
|
||||
|
||||
/* x/y/z deltas for the 10 movement directions (8 compass pts, 2 up/down) */
|
||||
const schar xdir[10] = { -1, -1, 0, 1, 1, 1, 0, -1, 0, 0 };
|
||||
const schar ydir[10] = { 0, -1, -1, -1, 0, 1, 1, 1, 0, 0 };
|
||||
@@ -108,9 +104,7 @@ const char *materialnm[] = { "mysterious", "liquid", "wax", "organic",
|
||||
"gemstone", "stone" };
|
||||
|
||||
/* Global windowing data, defined here for multi-window-system support */
|
||||
NEARDATA winid WIN_MESSAGE = WIN_ERR;
|
||||
NEARDATA winid WIN_STATUS = WIN_ERR;
|
||||
NEARDATA winid WIN_MAP = WIN_ERR, WIN_INVEN = WIN_ERR;
|
||||
NEARDATA winid WIN_MESSAGE, WIN_STATUS, WIN_MAP, WIN_INVEN;
|
||||
|
||||
#ifdef PREFIXES_IN_USE
|
||||
const char *fqn_prefix_names[PREFIX_COUNT] = {
|
||||
@@ -296,6 +290,7 @@ const struct instance_globals g_init = {
|
||||
"levels.*", /* alllevels */
|
||||
"bones*.*", /* allbones */
|
||||
#endif
|
||||
UNDEFINED_VALUES, /* program_state */
|
||||
|
||||
/* dig.c */
|
||||
UNDEFINED_VALUE, /* did_dig_msg */
|
||||
@@ -628,6 +623,9 @@ decl_globals_init()
|
||||
uarmh = uarms = uarmg = uarmf = uamul = uright = uleft = NULL;
|
||||
ublindf = uchain = uball = NULL;
|
||||
|
||||
WIN_MESSAGE = WIN_STATUS = WIN_MAP = WIN_INVEN = WIN_ERR;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*decl.c*/
|
||||
|
||||
+2
-2
@@ -719,7 +719,7 @@ register int x, y;
|
||||
if (g.in_mklev)
|
||||
return;
|
||||
#ifdef HANGUPHANDLING
|
||||
if (program_state.done_hup)
|
||||
if (g.program_state.done_hup)
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -1561,7 +1561,7 @@ int cursor_on_u;
|
||||
return; /* if already flushing then return */
|
||||
flushing = 1;
|
||||
#ifdef HANGUPHANDLING
|
||||
if (program_state.done_hup)
|
||||
if (g.program_state.done_hup)
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -744,7 +744,7 @@ struct obj *obj;
|
||||
*/
|
||||
if (!obj->oerodeproof || !rn2(10)) {
|
||||
/* if monsters aren't moving, assume player is responsible */
|
||||
if (!g.context.mon_moving && !program_state.gameover)
|
||||
if (!g.context.mon_moving && !g.program_state.gameover)
|
||||
costly_alteration(obj, COST_DEGRD);
|
||||
obj->otyp = WORM_TOOTH;
|
||||
obj->oerodeproof = 0;
|
||||
|
||||
+2
-2
@@ -1622,7 +1622,7 @@ boolean called;
|
||||
boolean name_at_start, has_adjectives;
|
||||
char *bp;
|
||||
|
||||
if (program_state.gameover)
|
||||
if (g.program_state.gameover)
|
||||
suppress |= SUPPRESS_HALLUCINATION;
|
||||
if (article == ARTICLE_YOUR && !mtmp->mtame)
|
||||
article = ARTICLE_THE;
|
||||
@@ -1630,7 +1630,7 @@ boolean called;
|
||||
do_hallu = Hallucination && !(suppress & SUPPRESS_HALLUCINATION);
|
||||
do_invis = mtmp->minvis && !(suppress & SUPPRESS_INVISIBLE);
|
||||
do_it = !canspotmon(mtmp) && article != ARTICLE_YOUR
|
||||
&& !program_state.gameover && mtmp != u.usteed
|
||||
&& !g.program_state.gameover && mtmp != u.usteed
|
||||
&& !(u.uswallow && mtmp == u.ustuck) && !(suppress & SUPPRESS_IT);
|
||||
do_saddle = !(suppress & SUPPRESS_SADDLE);
|
||||
do_name = !(suppress & SUPPRESS_NAME) || type_is_pname(mdat);
|
||||
|
||||
@@ -49,7 +49,7 @@ extern void FDECL(nethack_exit, (int));
|
||||
#define nethack_exit exit
|
||||
#endif
|
||||
|
||||
#define done_stopprint program_state.stopprint
|
||||
#define done_stopprint g.program_state.stopprint
|
||||
|
||||
#ifndef PANICTRACE
|
||||
#define NH_abort NH_abort_
|
||||
@@ -380,7 +380,7 @@ static void
|
||||
done_hangup(sig)
|
||||
int sig;
|
||||
{
|
||||
program_state.done_hup++;
|
||||
g.program_state.done_hup++;
|
||||
sethanguphandler((void FDECL((*), (int) )) SIG_IGN);
|
||||
done_intr(sig);
|
||||
return;
|
||||
@@ -545,7 +545,7 @@ VA_DECL(const char *, str)
|
||||
VA_START(str);
|
||||
VA_INIT(str, char *);
|
||||
|
||||
if (program_state.panicking++)
|
||||
if (g.program_state.panicking++)
|
||||
NH_abort(); /* avoid loops - this should never happen*/
|
||||
|
||||
if (iflags.window_inited) {
|
||||
@@ -555,9 +555,9 @@ VA_DECL(const char *, str)
|
||||
iflags.window_inited = 0; /* they're gone; force raw_print()ing */
|
||||
}
|
||||
|
||||
raw_print(program_state.gameover
|
||||
raw_print(g.program_state.gameover
|
||||
? "Postgame wrapup disrupted."
|
||||
: !program_state.something_worth_saving
|
||||
: !g.program_state.something_worth_saving
|
||||
? "Program initialization has failed."
|
||||
: "Suddenly, the dungeon collapses.");
|
||||
#ifndef MICRO
|
||||
@@ -565,11 +565,11 @@ VA_DECL(const char *, str)
|
||||
if (!wizard)
|
||||
raw_printf("Report the following error to \"%s\" or at \"%s\".",
|
||||
DEVTEAM_EMAIL, DEVTEAM_URL);
|
||||
else if (program_state.something_worth_saving)
|
||||
else if (g.program_state.something_worth_saving)
|
||||
raw_print("\nError save file being written.\n");
|
||||
#else /* !NOTIFY_NETHACK_BUGS */
|
||||
if (!wizard) {
|
||||
const char *maybe_rebuild = !program_state.something_worth_saving
|
||||
const char *maybe_rebuild = !g.program_state.something_worth_saving
|
||||
? "."
|
||||
: "\nand it may be possible to rebuild.";
|
||||
|
||||
@@ -587,7 +587,7 @@ VA_DECL(const char *, str)
|
||||
/* XXX can we move this above the prints? Then we'd be able to
|
||||
* suppress "it may be possible to rebuild" based on dosave0()
|
||||
* or say it's NOT possible to rebuild. */
|
||||
if (program_state.something_worth_saving && !iflags.debug_fuzzer) {
|
||||
if (g.program_state.something_worth_saving && !iflags.debug_fuzzer) {
|
||||
set_error_savefile();
|
||||
if (dosave0()) {
|
||||
/* os/win port specific recover instructions */
|
||||
@@ -1018,9 +1018,9 @@ int how;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (program_state.panicking
|
||||
if (g.program_state.panicking
|
||||
#ifdef HANGUPHANDLING
|
||||
|| program_state.done_hup
|
||||
|| g.program_state.done_hup
|
||||
#endif
|
||||
) {
|
||||
/* skip status update if panicking or disconnected */
|
||||
@@ -1032,7 +1032,7 @@ int how;
|
||||
}
|
||||
|
||||
if (iflags.debug_fuzzer) {
|
||||
if (!(program_state.panicking || how == PANICKED)) {
|
||||
if (!(g.program_state.panicking || how == PANICKED)) {
|
||||
savelife(how);
|
||||
/* periodically restore characteristics and lost exp levels
|
||||
or cure lycanthropy */
|
||||
@@ -1123,9 +1123,9 @@ int how;
|
||||
/*
|
||||
* The game is now over...
|
||||
*/
|
||||
program_state.gameover = 1;
|
||||
g.program_state.gameover = 1;
|
||||
/* in case of a subsequent panic(), there's no point trying to save */
|
||||
program_state.something_worth_saving = 0;
|
||||
g.program_state.something_worth_saving = 0;
|
||||
/* render vision subsystem inoperative */
|
||||
iflags.vision_inited = 0;
|
||||
|
||||
@@ -1611,13 +1611,13 @@ void
|
||||
nh_terminate(status)
|
||||
int status;
|
||||
{
|
||||
program_state.in_moveloop = 0; /* won't be returning to normal play */
|
||||
g.program_state.in_moveloop = 0; /* won't be returning to normal play */
|
||||
#ifdef MAC
|
||||
getreturn("to exit");
|
||||
#endif
|
||||
/* 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 */
|
||||
if (!program_state.panicking) {
|
||||
if (!g.program_state.panicking) {
|
||||
freedynamicdata();
|
||||
dlb_cleanup();
|
||||
}
|
||||
@@ -1630,10 +1630,10 @@ int status;
|
||||
*/
|
||||
/* don't call exit() if already executing within an exit handler;
|
||||
that would cancel any other pending user-mode handlers */
|
||||
if (program_state.exiting)
|
||||
if (g.program_state.exiting)
|
||||
return;
|
||||
#endif
|
||||
program_state.exiting = 1;
|
||||
g.program_state.exiting = 1;
|
||||
nethack_exit(status);
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -577,7 +577,7 @@ void
|
||||
clearlocks()
|
||||
{
|
||||
#ifdef HANGUPHANDLING
|
||||
if (program_state.preserve_locks)
|
||||
if (g.program_state.preserve_locks)
|
||||
return;
|
||||
#endif
|
||||
#if !defined(PC_LOCKING) && defined(MFLOPPY) && !defined(AMIGA)
|
||||
@@ -1611,7 +1611,7 @@ static int lockfd; /* for lock_file() to pass to unlock_file() */
|
||||
struct flock sflock; /* for unlocking, same as above */
|
||||
#endif
|
||||
|
||||
#define HUP if (!program_state.done_hup)
|
||||
#define HUP if (!g.program_state.done_hup)
|
||||
|
||||
#ifndef USE_FCNTL
|
||||
STATIC_OVL char *
|
||||
@@ -2341,13 +2341,13 @@ char *origbuf;
|
||||
*ptr = '\0';
|
||||
#ifdef MFLOPPY
|
||||
if (*(ptr + 1) == 'n' || *(ptr + 1) == 'N') {
|
||||
g.g.saveprompt = FALSE;
|
||||
g.saveprompt = FALSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if defined(SYSFLAGS) && defined(MFLOPPY)
|
||||
else
|
||||
g.g.g.saveprompt = sysflags.asksavedisk;
|
||||
g.saveprompt = sysflags.asksavedisk;
|
||||
#endif
|
||||
|
||||
(void) strncpy(SAVEP, bufp, SAVESIZE - 1);
|
||||
@@ -2974,14 +2974,14 @@ read_wizkit()
|
||||
if (!wizard || !(fp = fopen_wizkit_file()))
|
||||
return;
|
||||
|
||||
program_state.wizkit_wishing = 1;
|
||||
g.program_state.wizkit_wishing = 1;
|
||||
config_error_init(TRUE, "WIZKIT", FALSE);
|
||||
|
||||
parse_conf_file(fp, proc_wizkit_line);
|
||||
(void) fclose(fp);
|
||||
|
||||
config_error_done();
|
||||
program_state.wizkit_wishing = 0;
|
||||
g.program_state.wizkit_wishing = 0;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -3531,8 +3531,8 @@ const char *reason; /* explanation */
|
||||
FILE *lfile;
|
||||
char buf[BUFSZ];
|
||||
|
||||
if (!program_state.in_paniclog) {
|
||||
program_state.in_paniclog = 1;
|
||||
if (!g.program_state.in_paniclog) {
|
||||
g.program_state.in_paniclog = 1;
|
||||
lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX);
|
||||
if (lfile) {
|
||||
#ifdef PANICLOG_FMT2
|
||||
@@ -3550,7 +3550,7 @@ const char *reason; /* explanation */
|
||||
#endif /* !PANICLOG_FMT2 */
|
||||
(void) fclose(lfile);
|
||||
}
|
||||
program_state.in_paniclog = 0;
|
||||
g.program_state.in_paniclog = 0;
|
||||
}
|
||||
#endif /* PANICLOG */
|
||||
return;
|
||||
|
||||
+2
-2
@@ -220,7 +220,7 @@ struct obj *obj;
|
||||
if (wizard) { /* flags.debug */
|
||||
/* paranoia: before toggling off wizard mode, guard against a
|
||||
panic in xname() producing a normal mode panic save file */
|
||||
program_state.something_worth_saving = 0;
|
||||
g.program_state.something_worth_saving = 0;
|
||||
flags.debug = FALSE;
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ struct obj *obj;
|
||||
|
||||
if (save_debug) {
|
||||
flags.debug = TRUE;
|
||||
program_state.something_worth_saving = 1;
|
||||
g.program_state.something_worth_saving = 1;
|
||||
}
|
||||
/* restore the object */
|
||||
if (obj->oclass == POTION_CLASS) {
|
||||
|
||||
@@ -739,7 +739,7 @@ movemon()
|
||||
if (u.utotype
|
||||
#ifdef SAFERHANGUP
|
||||
/* or if the program has lost contact with the user */
|
||||
|| program_state.done_hup
|
||||
|| g.program_state.done_hup
|
||||
#endif
|
||||
) {
|
||||
somebody_can_move = FALSE;
|
||||
|
||||
+1
-1
@@ -360,7 +360,7 @@ boolean credit_hero;
|
||||
exercise(A_WIS, TRUE);
|
||||
}
|
||||
/* moves==1L => initial inventory, gameover => final disclosure */
|
||||
if (g.moves > 1L && !program_state.gameover) {
|
||||
if (g.moves > 1L && !g.program_state.gameover) {
|
||||
if (objects[oindx].oc_class == GEM_CLASS)
|
||||
gem_learned(oindx); /* could affect price of unpaid gems */
|
||||
update_inventory();
|
||||
|
||||
+3
-3
@@ -204,7 +204,7 @@ struct obj *obj;
|
||||
{
|
||||
if (!obj->oartifact || !has_oname(obj))
|
||||
return FALSE;
|
||||
if (!program_state.gameover && !iflags.override_ID) {
|
||||
if (!g.program_state.gameover && !iflags.override_ID) {
|
||||
if (not_fully_identified(obj))
|
||||
return FALSE;
|
||||
}
|
||||
@@ -692,7 +692,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
||||
if (pluralize)
|
||||
Strcpy(buf, makeplural(buf));
|
||||
|
||||
if (obj->otyp == T_SHIRT && program_state.gameover) {
|
||||
if (obj->otyp == T_SHIRT && g.program_state.gameover) {
|
||||
char tmpbuf[BUFSZ];
|
||||
|
||||
Sprintf(eos(buf), " with text \"%s\"", tshirt_text(obj, tmpbuf));
|
||||
@@ -3550,7 +3550,7 @@ srch:
|
||||
* Disallow such topology tweaks for WIZKIT startup wishes.
|
||||
*/
|
||||
wiztrap:
|
||||
if (wizard && !program_state.wizkit_wishing) {
|
||||
if (wizard && !g.program_state.wizkit_wishing) {
|
||||
struct rm *lev;
|
||||
int trap, x = u.ux, y = u.uy;
|
||||
|
||||
|
||||
+6
-6
@@ -103,10 +103,10 @@ VA_DECL(const char *, line)
|
||||
if (!line || !*line)
|
||||
return;
|
||||
#ifdef HANGUPHANDLING
|
||||
if (program_state.done_hup)
|
||||
if (g.program_state.done_hup)
|
||||
return;
|
||||
#endif
|
||||
if (program_state.wizkit_wishing)
|
||||
if (g.program_state.wizkit_wishing)
|
||||
return;
|
||||
|
||||
if (index(line, '%')) {
|
||||
@@ -445,10 +445,10 @@ VA_DECL(const char *, s)
|
||||
|
||||
VA_START(s);
|
||||
VA_INIT(s, const char *);
|
||||
if (program_state.in_impossible)
|
||||
if (g.program_state.in_impossible)
|
||||
panic("impossible called impossible");
|
||||
|
||||
program_state.in_impossible = 1;
|
||||
g.program_state.in_impossible = 1;
|
||||
Vsprintf(pbuf, s, VA_ARGS);
|
||||
pbuf[BUFSZ - 1] = '\0'; /* sanity */
|
||||
paniclog("impossible", pbuf);
|
||||
@@ -457,11 +457,11 @@ VA_DECL(const char *, s)
|
||||
pline("%s", VA_PASS1(pbuf));
|
||||
/* reuse pbuf[] */
|
||||
Strcpy(pbuf, "Program in disorder!");
|
||||
if (program_state.something_worth_saving)
|
||||
if (g.program_state.something_worth_saving)
|
||||
Strcat(pbuf, " (Saving and reloading may fix this problem.)");
|
||||
pline("%s", VA_PASS1(pbuf));
|
||||
|
||||
program_state.in_impossible = 0;
|
||||
g.program_state.in_impossible = 0;
|
||||
VA_END();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -335,7 +335,7 @@ char *pname; /* caller-supplied output buffer */
|
||||
Strcat(pname, what);
|
||||
/* same as distant_monnam(), more or less... */
|
||||
if (do_hallu || !high_priest || !Is_astralevel(&u.uz)
|
||||
|| distu(mon->mx, mon->my) <= 2 || program_state.gameover) {
|
||||
|| distu(mon->mx, mon->my) <= 2 || g.program_state.gameover) {
|
||||
Strcat(pname, " of ");
|
||||
Strcat(pname, halu_gname(mon_aligntyp(mon)));
|
||||
}
|
||||
|
||||
+1
-1
@@ -574,7 +574,7 @@ skip_pager(common)
|
||||
boolean common;
|
||||
{
|
||||
/* WIZKIT: suppress plot feedback if starting with quest artifact */
|
||||
if (program_state.wizkit_wishing)
|
||||
if (g.program_state.wizkit_wishing)
|
||||
return TRUE;
|
||||
if (!(common ? g.qt_list.common : g.qt_list.chrole)) {
|
||||
panic("%s: no %s quest text data available",
|
||||
|
||||
+1
-1
@@ -888,7 +888,7 @@ register int fd;
|
||||
reset_restpref();
|
||||
|
||||
restlevelstate(stuckid, steedid);
|
||||
program_state.something_worth_saving = 1; /* useful data now exists */
|
||||
g.program_state.something_worth_saving = 1; /* useful data now exists */
|
||||
|
||||
if (!wizard && !discover)
|
||||
(void) delete_savefile();
|
||||
|
||||
+3
-3
@@ -544,16 +544,16 @@ STATIC_OVL void
|
||||
couldnt_open_file(filename)
|
||||
const char *filename;
|
||||
{
|
||||
int save_something = program_state.something_worth_saving;
|
||||
int save_something = g.program_state.something_worth_saving;
|
||||
|
||||
/* most likely the file is missing, so suppress impossible()'s
|
||||
"saving and restoring might fix this" (unless the fuzzer,
|
||||
which escalates impossible to panic, is running) */
|
||||
if (!iflags.debug_fuzzer)
|
||||
program_state.something_worth_saving = 0;
|
||||
g.program_state.something_worth_saving = 0;
|
||||
|
||||
impossible("Can't open '%s' file.", filename);
|
||||
program_state.something_worth_saving = save_something;
|
||||
g.program_state.something_worth_saving = save_something;
|
||||
}
|
||||
|
||||
/*rumors.c*/
|
||||
|
||||
+7
-7
@@ -66,7 +66,7 @@ static struct save_procs {
|
||||
};
|
||||
|
||||
#if defined(UNIX) || defined(VMS) || defined(__EMX__) || defined(WIN32)
|
||||
#define HUP if (!program_state.done_hup)
|
||||
#define HUP if (!g.program_state.done_hup)
|
||||
#else
|
||||
#define HUP
|
||||
#endif
|
||||
@@ -85,7 +85,7 @@ dosave()
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
pline("Saving...");
|
||||
#if defined(UNIX) || defined(VMS) || defined(__EMX__)
|
||||
program_state.done_hup = 0;
|
||||
g.program_state.done_hup = 0;
|
||||
#endif
|
||||
if (dosave0()) {
|
||||
u.uhp = -1; /* universal game's over indicator */
|
||||
@@ -120,7 +120,7 @@ dosave0()
|
||||
if (iflags.save_uburied)
|
||||
u.uburied = 1, iflags.save_uburied = 0;
|
||||
|
||||
if (!program_state.something_worth_saving || !SAVEF[0])
|
||||
if (!g.program_state.something_worth_saving || !SAVEF[0])
|
||||
return 0;
|
||||
fq_save = fqname(SAVEF, SAVEPREFIX, 1); /* level files take 0 */
|
||||
|
||||
@@ -269,7 +269,7 @@ dosave0()
|
||||
delete_levelfile(0);
|
||||
nh_compress(fq_save);
|
||||
/* this should probably come sooner... */
|
||||
program_state.something_worth_saving = 0;
|
||||
g.program_state.something_worth_saving = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -726,7 +726,7 @@ register unsigned num;
|
||||
|
||||
if (failed) {
|
||||
#if defined(UNIX) || defined(VMS) || defined(__EMX__)
|
||||
if (program_state.done_hup)
|
||||
if (g.program_state.done_hup)
|
||||
nh_terminate(EXIT_FAILURE);
|
||||
else
|
||||
#endif
|
||||
@@ -832,7 +832,7 @@ register int fd;
|
||||
if (outbufp) {
|
||||
if (write(fd, outbuf, outbufp) != outbufp) {
|
||||
#if defined(UNIX) || defined(VMS) || defined(__EMX__)
|
||||
if (program_state.done_hup)
|
||||
if (g.program_state.done_hup)
|
||||
nh_terminate(EXIT_FAILURE);
|
||||
else
|
||||
#endif
|
||||
@@ -858,7 +858,7 @@ register unsigned num;
|
||||
#endif
|
||||
if ((unsigned) write(fd, loc, num) != num) {
|
||||
#if defined(UNIX) || defined(VMS) || defined(__EMX__)
|
||||
if (program_state.done_hup)
|
||||
if (g.program_state.done_hup)
|
||||
nh_terminate(EXIT_FAILURE);
|
||||
else
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -851,7 +851,7 @@ struct monst *mtmp;
|
||||
} else {
|
||||
const char *shknm = ESHK(mtmp)->shknam;
|
||||
|
||||
if (Hallucination && !program_state.gameover) {
|
||||
if (Hallucination && !g.program_state.gameover) {
|
||||
const char *const *nlp;
|
||||
int num;
|
||||
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@
|
||||
static long final_fpos;
|
||||
#endif
|
||||
|
||||
#define done_stopprint program_state.stopprint
|
||||
#define done_stopprint g.program_state.stopprint
|
||||
|
||||
#define newttentry() (struct toptenentry *) alloc(sizeof (struct toptenentry))
|
||||
#define dealloc_ttentry(ttent) free((genericptr_t) (ttent))
|
||||
@@ -511,7 +511,7 @@ time_t when;
|
||||
* topten uses alloc() several times, which will lead to
|
||||
* problems if the panic was the result of an alloc() failure.
|
||||
*/
|
||||
if (program_state.panicking)
|
||||
if (g.program_state.panicking)
|
||||
return;
|
||||
|
||||
if (iflags.toptenwin) {
|
||||
@@ -519,7 +519,7 @@ time_t when;
|
||||
}
|
||||
|
||||
#if defined(UNIX) || defined(VMS) || defined(__EMX__)
|
||||
#define HUP if (!program_state.done_hup)
|
||||
#define HUP if (!g.program_state.done_hup)
|
||||
#else
|
||||
#define HUP
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -812,9 +812,9 @@ skip:
|
||||
/* This newsym() caused a crash delivering msg about failure to open
|
||||
* dungeon file init_dungeons() -> panic() -> done(11) ->
|
||||
* vision_recalc(2) -> newsym() -> crash! u.ux and u.uy are 0 and
|
||||
* program_state.panicking == 1 under those circumstances
|
||||
* g.program_state.panicking == 1 under those circumstances
|
||||
*/
|
||||
if (!program_state.panicking)
|
||||
if (!g.program_state.panicking)
|
||||
newsym(u.ux, u.uy); /* Make sure the hero shows up! */
|
||||
|
||||
/* Set the new min and max pointers. */
|
||||
|
||||
+2
-2
@@ -191,7 +191,7 @@ char *argv[];
|
||||
* It seems you really want to play.
|
||||
*/
|
||||
u.uhp = 1; /* prevent RIP on early quits */
|
||||
program_state.preserve_locks = 1;
|
||||
g.program_state.preserve_locks = 1;
|
||||
#ifndef NO_SIGNAL
|
||||
sethanguphandler((SIG_RET_TYPE) hangup);
|
||||
#endif
|
||||
@@ -277,7 +277,7 @@ attempt_restore:
|
||||
*/
|
||||
if (*g.plname) {
|
||||
getlock();
|
||||
program_state.preserve_locks = 0; /* after getlock() */
|
||||
g.program_state.preserve_locks = 0; /* after getlock() */
|
||||
}
|
||||
|
||||
if (*g.plname && (fd = restore_saved_game()) >= 0) {
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ eraseoldlocks()
|
||||
{
|
||||
register int i;
|
||||
|
||||
program_state.preserve_locks = 0; /* not required but shows intent */
|
||||
g.program_state.preserve_locks = 0; /* not required but shows intent */
|
||||
/* cannot use maxledgerno() here, because we need to find a lock name
|
||||
* before starting everything (including the dungeon initialization
|
||||
* that sets astral_level, needed for maxledgerno()) up
|
||||
|
||||
+2
-2
@@ -391,7 +391,7 @@ byebye()
|
||||
|
||||
/* SIGHUP doesn't seem to do anything on VMS, so we fudge it here... */
|
||||
hup = (void FDECL((*), (int) )) signal(SIGHUP, SIG_IGN);
|
||||
if (!program_state.exiting++ && hup != (void FDECL((*), (int) )) SIG_DFL
|
||||
if (!g.program_state.exiting++ && hup != (void FDECL((*), (int) )) SIG_DFL
|
||||
&& hup != (void FDECL((*), (int) )) SIG_IGN) {
|
||||
(*hup)(SIGHUP);
|
||||
}
|
||||
@@ -414,7 +414,7 @@ genericptr_t sigargs, mechargs; /* [0] is argc, [1..argc] are the real args */
|
||||
if (condition == SS$_ACCVIO /* access violation */
|
||||
|| (condition >= SS$_ASTFLT && condition <= SS$_TBIT)
|
||||
|| (condition >= SS$_ARTRES && condition <= SS$_INHCHME)) {
|
||||
program_state.done_hup = TRUE; /* pretend hangup has been attempted */
|
||||
g.program_state.done_hup = TRUE; /* pretend hangup has been attempted */
|
||||
#ifndef BETA
|
||||
if (wizard)
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ vms_getchar()
|
||||
static volatile int recurse = 0; /* SMG is not AST re-entrant! */
|
||||
#endif
|
||||
|
||||
if (program_state.done_hup) {
|
||||
if (g.program_state.done_hup) {
|
||||
/* hangup has occurred; do not attempt to get further user input */
|
||||
return ESC;
|
||||
}
|
||||
|
||||
+3
-3
@@ -39,7 +39,7 @@ mswin_have_input()
|
||||
return
|
||||
#ifdef SAFERHANGUP
|
||||
/* we always have input (ESC) if hangup was requested */
|
||||
program_state.done_hup ||
|
||||
g.program_state.done_hup ||
|
||||
#endif
|
||||
(nhi_read_pos != nhi_write_pos);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ mswin_input_pop()
|
||||
|
||||
#ifdef SAFERHANGUP
|
||||
/* always return ESC when hangup was requested */
|
||||
if (program_state.done_hup) {
|
||||
if (g.program_state.done_hup) {
|
||||
static MSNHEvent hangup_event;
|
||||
hangup_event.type = NHEVENT_CHAR;
|
||||
hangup_event.kbd.ch = '\033';
|
||||
@@ -98,7 +98,7 @@ mswin_input_peek()
|
||||
|
||||
#ifdef SAFERHANGUP
|
||||
/* always return ESC when hangup was requested */
|
||||
if (program_state.done_hup) {
|
||||
if (g.program_state.done_hup) {
|
||||
static MSNHEvent hangup_event;
|
||||
hangup_event.type = NHEVENT_CHAR;
|
||||
hangup_event.kbd.ch = '\033';
|
||||
|
||||
+1
-1
@@ -533,7 +533,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
if (!data->text.text) {
|
||||
data->text.text = mswin_init_text_buffer(
|
||||
program_state.gameover ? FALSE : GetNHApp()->bWrapText);
|
||||
g.program_state.gameover ? FALSE : GetNHApp()->bWrapText);
|
||||
if (!data->text.text)
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ mswin_init_text_window()
|
||||
|
||||
ZeroMemory(data, sizeof(NHTextWindow));
|
||||
data->window_text = mswin_init_text_buffer(
|
||||
program_state.gameover ? FALSE : GetNHApp()->bWrapText);
|
||||
g.program_state.gameover ? FALSE : GetNHApp()->bWrapText);
|
||||
SetWindowLong(ret, GWL_USERDATA, (LONG) data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ static char author[] = "The NetHack Development Team";
|
||||
|
||||
extern HANDLE hConIn;
|
||||
extern INPUT_RECORD ir;
|
||||
extern struct sinfo program_state;
|
||||
|
||||
char dllname[512];
|
||||
char *shortdllname;
|
||||
|
||||
+2
-2
@@ -443,7 +443,7 @@ tgetch()
|
||||
really_move_cursor();
|
||||
if (iflags.debug_fuzzer)
|
||||
return randomkey();
|
||||
return (program_state.done_hup)
|
||||
return (g.program_state.done_hup)
|
||||
? '\033'
|
||||
: keyboard_handler.pCheckInput(
|
||||
console.hConIn, &ir, &count, iflags.num_pad, 0, &mod, &cc);
|
||||
@@ -459,7 +459,7 @@ int *x, *y, *mod;
|
||||
really_move_cursor();
|
||||
if (iflags.debug_fuzzer)
|
||||
return randomkey();
|
||||
ch = (program_state.done_hup)
|
||||
ch = (g.program_state.done_hup)
|
||||
? '\033'
|
||||
: keyboard_handler.pCheckInput(
|
||||
console.hConIn, &ir, &count, iflags.num_pad, 1, mod, &cc);
|
||||
|
||||
+7
-7
@@ -4029,7 +4029,7 @@ void NetHackQtMainWindow::keyPressEvent(QKeyEvent* event)
|
||||
|
||||
void NetHackQtMainWindow::closeEvent(QCloseEvent* e)
|
||||
{
|
||||
if ( program_state.something_worth_saving ) {
|
||||
if ( g.program_state.something_worth_saving ) {
|
||||
switch ( QMessageBox::information( this, "NetHack",
|
||||
"This will end your NetHack session",
|
||||
"&Save", "&Cancel", 0, 1 ) )
|
||||
@@ -4840,7 +4840,7 @@ void NetHackQtBind::qt_update_inventory()
|
||||
if (main)
|
||||
main->updateInventory();
|
||||
/* doesn't work yet
|
||||
if (program_state.something_worth_saving && iflags.perm_invent)
|
||||
if (g.program_state.something_worth_saving && iflags.perm_invent)
|
||||
display_inventory(NULL, FALSE);
|
||||
*/
|
||||
}
|
||||
@@ -4894,14 +4894,14 @@ int NetHackQtBind::qt_nhgetch()
|
||||
//
|
||||
while (keybuffer.Empty()
|
||||
#ifdef SAFERHANGUP
|
||||
&& !program_state.done_hup
|
||||
&& !g.program_state.done_hup
|
||||
#endif
|
||||
) {
|
||||
qApp->enter_loop();
|
||||
}
|
||||
|
||||
#ifdef SAFERHANGUP
|
||||
if (program_state.done_hup && keybuffer.Empty()) return '\033';
|
||||
if (g.program_state.done_hup && keybuffer.Empty()) return '\033';
|
||||
#endif
|
||||
return keybuffer.GetAscii();
|
||||
}
|
||||
@@ -4915,13 +4915,13 @@ int NetHackQtBind::qt_nh_poskey(int *x, int *y, int *mod)
|
||||
//
|
||||
while (keybuffer.Empty() && clickbuffer.Empty()
|
||||
#ifdef SAFERHANGUP
|
||||
&& !program_state.done_hup
|
||||
&& !g.program_state.done_hup
|
||||
#endif
|
||||
) {
|
||||
qApp->enter_loop();
|
||||
}
|
||||
#ifdef SAFERHANGUP
|
||||
if (program_state.done_hup && keybuffer.Empty()) return '\033';
|
||||
if (g.program_state.done_hup && keybuffer.Empty()) return '\033';
|
||||
#endif
|
||||
if (!keybuffer.Empty()) {
|
||||
return keybuffer.GetAscii();
|
||||
@@ -5170,7 +5170,7 @@ bool NetHackQtBind::notify(QObject *receiver, QEvent *event)
|
||||
|
||||
bool result=QApplication::notify(receiver,event);
|
||||
#ifdef SAFERHANGUP
|
||||
if (program_state.done_hup) {
|
||||
if (g.program_state.done_hup) {
|
||||
keybuffer.Put('\033');
|
||||
qApp->exit_loop();
|
||||
return TRUE;
|
||||
|
||||
+1
-1
@@ -401,7 +401,7 @@ void NetHackQtBind::qt_update_inventory()
|
||||
if (main)
|
||||
main->updateInventory();
|
||||
/* doesn't work yet
|
||||
if (program_state.something_worth_saving && iflags.perm_invent)
|
||||
if (g.program_state.something_worth_saving && iflags.perm_invent)
|
||||
display_inventory(NULL, false);
|
||||
*/
|
||||
}
|
||||
|
||||
+1
-1
@@ -1029,7 +1029,7 @@ void NetHackQtMainWindow::keyPressEvent(QKeyEvent* event)
|
||||
|
||||
void NetHackQtMainWindow::closeEvent(QCloseEvent* e)
|
||||
{
|
||||
if ( program_state.something_worth_saving ) {
|
||||
if ( g.program_state.something_worth_saving ) {
|
||||
switch ( QMessageBox::information( this, "NetHack",
|
||||
"This will end your NetHack session",
|
||||
"&Save", "&Cancel", 0, 1 ) )
|
||||
|
||||
+2
-2
@@ -1701,7 +1701,7 @@ int exit_condition;
|
||||
inptr = (inptr + 1) % INBUF_SIZE;
|
||||
/* pkey(retval); */
|
||||
keep_going = FALSE;
|
||||
} else if (program_state.done_hup) {
|
||||
} else if (g.program_state.done_hup) {
|
||||
retval = '\033';
|
||||
inptr = (inptr + 1) % INBUF_SIZE;
|
||||
keep_going = FALSE;
|
||||
@@ -1720,7 +1720,7 @@ int exit_condition;
|
||||
/* pkey(retval); */
|
||||
}
|
||||
keep_going = FALSE;
|
||||
} else if (program_state.done_hup) {
|
||||
} else if (g.program_state.done_hup) {
|
||||
retval = '\033';
|
||||
inptr = (inptr + 1) % INBUF_SIZE;
|
||||
keep_going = FALSE;
|
||||
|
||||
+5
-5
@@ -1266,7 +1266,7 @@ X11_player_selection_dialog()
|
||||
if (plsel_align_radios)
|
||||
free(plsel_align_radios);
|
||||
|
||||
if (ps_selected == PS_QUIT || program_state.done_hup) {
|
||||
if (ps_selected == PS_QUIT || g.program_state.done_hup) {
|
||||
clearlocks();
|
||||
X11_exit_nhwindows((char *) 0);
|
||||
nh_terminate(0);
|
||||
@@ -1341,7 +1341,7 @@ X11_player_selection_prompts()
|
||||
XtDestroyWidget(popup);
|
||||
free((genericptr_t) choices), choices = 0;
|
||||
|
||||
if (ps_selected == PS_QUIT || program_state.done_hup) {
|
||||
if (ps_selected == PS_QUIT || g.program_state.done_hup) {
|
||||
clearlocks();
|
||||
X11_exit_nhwindows((char *) 0);
|
||||
nh_terminate(0);
|
||||
@@ -1410,7 +1410,7 @@ X11_player_selection_prompts()
|
||||
XtDestroyWidget(popup);
|
||||
free((genericptr_t) choices), choices = 0;
|
||||
|
||||
if (ps_selected == PS_QUIT || program_state.done_hup) {
|
||||
if (ps_selected == PS_QUIT || g.program_state.done_hup) {
|
||||
clearlocks();
|
||||
X11_exit_nhwindows((char *) 0);
|
||||
nh_terminate(0);
|
||||
@@ -1478,7 +1478,7 @@ X11_player_selection_prompts()
|
||||
XtDestroyWidget(popup);
|
||||
free((genericptr_t) choices), choices = 0;
|
||||
|
||||
if (ps_selected == PS_QUIT || program_state.done_hup) {
|
||||
if (ps_selected == PS_QUIT || g.program_state.done_hup) {
|
||||
clearlocks();
|
||||
X11_exit_nhwindows((char *) 0);
|
||||
nh_terminate(0);
|
||||
@@ -1544,7 +1544,7 @@ X11_player_selection_prompts()
|
||||
XtDestroyWidget(popup);
|
||||
free((genericptr_t) choices), choices = 0;
|
||||
|
||||
if (ps_selected == PS_QUIT || program_state.done_hup) {
|
||||
if (ps_selected == PS_QUIT || g.program_state.done_hup) {
|
||||
clearlocks();
|
||||
X11_exit_nhwindows((char *) 0);
|
||||
nh_terminate(0);
|
||||
|
||||
@@ -623,7 +623,7 @@ curses_display_nhmenu(winid wid, int how, MENU_ITEM_P ** _selected)
|
||||
menu_determine_pages(current_menu);
|
||||
|
||||
/* Display pre and post-game menus centered */
|
||||
if (((g.moves <= 1) && !g.invent) || program_state.gameover) {
|
||||
if (((g.moves <= 1) && !g.invent) || g.program_state.gameover) {
|
||||
win = curses_create_window(current_menu->width,
|
||||
current_menu->height, CENTER);
|
||||
} else { /* Display during-game menus on the right out of the way */
|
||||
|
||||
+2
-2
@@ -907,7 +907,7 @@ gnome_nhgetch()
|
||||
g_askingQuestion = 1;
|
||||
/* Process events until a key press event arrives. */
|
||||
while (g_numKeys == 0) {
|
||||
if (program_state.done_hup)
|
||||
if (g.program_state.done_hup)
|
||||
return '\033';
|
||||
gtk_main_iteration();
|
||||
}
|
||||
@@ -945,7 +945,7 @@ gnome_nh_poskey(int *x, int *y, int *mod)
|
||||
g_askingQuestion = 0;
|
||||
/* Process events until a key or map-click arrives. */
|
||||
while (g_numKeys == 0 && g_numClicks == 0) {
|
||||
if (program_state.done_hup)
|
||||
if (g.program_state.done_hup)
|
||||
return '\033';
|
||||
gtk_main_iteration();
|
||||
}
|
||||
|
||||
+1
-1
@@ -218,7 +218,7 @@ register const char *s; /* chars allowed besides return */
|
||||
morc = 0;
|
||||
while (
|
||||
#ifdef HANGUPHANDLING
|
||||
!program_state.done_hup &&
|
||||
!g.program_state.done_hup &&
|
||||
#endif
|
||||
(c = tty_nhgetch()) != EOF) {
|
||||
if (c == '\n' || c == '\r')
|
||||
|
||||
+3
-3
@@ -56,7 +56,7 @@ extern short glyph2tile[];
|
||||
*/
|
||||
#define HUPSKIP() \
|
||||
do { \
|
||||
if (program_state.done_hup) { \
|
||||
if (g.program_state.done_hup) { \
|
||||
morc = '\033'; \
|
||||
return; \
|
||||
} \
|
||||
@@ -64,7 +64,7 @@ extern short glyph2tile[];
|
||||
/* morc=ESC - in case we bypass xwaitforspace() which sets that */
|
||||
#define HUPSKIP_RESULT(RES) \
|
||||
do { \
|
||||
if (program_state.done_hup) \
|
||||
if (g.program_state.done_hup) \
|
||||
return (RES); \
|
||||
} while (0)
|
||||
#else /* !HANGUP_HANDLING */
|
||||
@@ -3085,7 +3085,7 @@ tty_wait_synch()
|
||||
if (ttyDisplay->inmore) {
|
||||
addtopl("--More--");
|
||||
(void) fflush(stdout);
|
||||
} else if (ttyDisplay->inread > program_state.gameover) {
|
||||
} else if (ttyDisplay->inread > g.program_state.gameover) {
|
||||
/* this can only happen if we were reading and got interrupted */
|
||||
ttyDisplay->toplin = 3;
|
||||
/* do this twice; 1st time gets the Quit? message again */
|
||||
|
||||
+3
-3
@@ -39,7 +39,7 @@ mswin_have_input()
|
||||
return
|
||||
#ifdef SAFERHANGUP
|
||||
/* we always have input (ESC) if hangup was requested */
|
||||
program_state.done_hup ||
|
||||
g.program_state.done_hup ||
|
||||
#endif
|
||||
(nhi_read_pos != nhi_write_pos);
|
||||
}
|
||||
@@ -69,7 +69,7 @@ mswin_input_pop()
|
||||
|
||||
#ifdef SAFERHANGUP
|
||||
/* always return ESC when hangup was requested */
|
||||
if (program_state.done_hup) {
|
||||
if (g.program_state.done_hup) {
|
||||
static MSNHEvent hangup_event;
|
||||
hangup_event.type = NHEVENT_CHAR;
|
||||
hangup_event.kbd.ch = '\033';
|
||||
@@ -98,7 +98,7 @@ mswin_input_peek()
|
||||
|
||||
#ifdef SAFERHANGUP
|
||||
/* always return ESC when hangup was requested */
|
||||
if (program_state.done_hup) {
|
||||
if (g.program_state.done_hup) {
|
||||
static MSNHEvent hangup_event;
|
||||
hangup_event.type = NHEVENT_CHAR;
|
||||
hangup_event.kbd.ch = '\033';
|
||||
|
||||
+4
-4
@@ -452,16 +452,16 @@ MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
case WM_CLOSE: {
|
||||
/* exit gracefully */
|
||||
if (program_state.gameover) {
|
||||
if (g.program_state.gameover) {
|
||||
/* assume the user really meant this, as the game is already
|
||||
* over... */
|
||||
/* to make sure we still save bones, just set stop printing flag
|
||||
*/
|
||||
program_state.stopprint++;
|
||||
g.program_state.stopprint++;
|
||||
NHEVENT_KBD(
|
||||
'\033'); /* and send keyboard input as if user pressed ESC */
|
||||
/* additional code for this is done in menu and rip windows */
|
||||
} else if (!program_state.something_worth_saving) {
|
||||
} else if (!g.program_state.something_worth_saving) {
|
||||
/* User exited before the game started, e.g. during splash display
|
||||
*/
|
||||
/* Just get out. */
|
||||
@@ -837,7 +837,7 @@ onWMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
case IDM_SAVE:
|
||||
if (iflags.debug_fuzzer)
|
||||
break;
|
||||
if (!program_state.gameover && !program_state.done_hup)
|
||||
if (!g.program_state.gameover && !g.program_state.done_hup)
|
||||
dosave();
|
||||
else
|
||||
MessageBeep(0);
|
||||
|
||||
+2
-2
@@ -348,10 +348,10 @@ MenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return FALSE;
|
||||
|
||||
case WM_CLOSE:
|
||||
if (program_state.gameover) {
|
||||
if (g.program_state.gameover) {
|
||||
data->result = -1;
|
||||
data->done = 1;
|
||||
program_state.stopprint++;
|
||||
g.program_state.stopprint++;
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ NHRIPWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
GetNHApp()->hMainWnd = NULL;
|
||||
DestroyWindow(hWnd);
|
||||
SetFocus(GetNHApp()->hMainWnd);
|
||||
program_state.stopprint++;
|
||||
g.program_state.stopprint++;
|
||||
return TRUE;
|
||||
|
||||
case WM_DESTROY:
|
||||
|
||||
+1
-1
@@ -1224,7 +1224,7 @@ void
|
||||
mswin_update_inventory()
|
||||
{
|
||||
logDebug("mswin_update_inventory()\n");
|
||||
if (iflags.perm_invent && program_state.something_worth_saving
|
||||
if (iflags.perm_invent && g.program_state.something_worth_saving
|
||||
&& iflags.window_inited && WIN_INVEN != WIN_ERR)
|
||||
display_inventory(NULL, FALSE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user