program_state moved to g.

This commit is contained in:
Bart House
2018-12-25 10:09:04 -08:00
parent ab73df996f
commit b1ab64db43
45 changed files with 130 additions and 132 deletions

View File

@@ -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) {

View File

@@ -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

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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';

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);