program_state moved to g.
This commit is contained in:
+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